Manage Learn to apply best practices and optimize your operations.

Agents To Change Field of Your Choice on Selected Docs

Copy these two agents into any Notes database to be able to change the field of your choice on selected documents.


*******Code for "Change Field on Selected Documents"*******
*To be run once*
*This agent will call the agent below*
FieldToChange := @Prompt([OKCANCELEDIT]; "Field to Change"; "Enter the name of the field to change."; "");
TypeOfData := @Prompt([OKCANCELLIST]:[NoSort]; "Type of Field"; "Is this field Text, Number or DateTime?"; "Text"; "Text":"Number":"DateTime");
NewValue:=@Prompt([OKCANCELEDIT];"New Value";"Enter the new value for this field";"");

@If(FieldToChange=""|TypeOfData="";@Do(@Prompt([OK];"Error";"You did not enter all requested data. Process halted.");@Return(""));"");

NumberValue:=@TextToNumber(NewValue);
valueerror:=@IsError(@If(TypeOfData="Number";NumberValue;3));
@If(valueerror=1;
@Do(@Prompt([OK];"Error";"You did not specify a number for the new value. Process halted.");@Return(""));
"");

DateError:=@If(TypeOfData="DateTime";@If(@Text(@TextToTime(NewValue))="";1;0);0)
;
@If(DateError=1;
@Do(@Prompt([OK];"Error";"You did not specify a date/time for the new value. Process halted.");@Return(""));
"");

continue := @Prompt([YESNO];"Click yes to continue.";"This agent will change the value of the *"+ FieldToChange +"* field on the selected documents to *"+ NewValue + "* . Continue?");

@If(continue=1;"";@Return(""));

@Environment("Field"; FieldToChange);
@Environment("Type"; TypeOfData);
@Environment("Val"; NewValue);
@Command([ToolsRunMacro];"Process Change")

 

*******Code for Process Change*******
*To be run against all selected documents*
FieldToChange := @Environment("Field" );
NewValue := @Environment( "Val");
TypeOfData:=@Environment( "Type");

@SetField(FieldToChange;
@If(TypeOfData="Text";NewValue;
TypeOfData="Number";@TextToNumber(NewValue);
@TextToTime(NewValue)));

SELECT @All

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close