Replace any field value action

Have you ever had one of your customers enter an incorrect value into a field and find you are unable to open the document due to that wrong field? Well this simple action will allow you to correct this problem in a view.

The steps are fairly simple. Create an action and call it what you would like. I use "Set a Value in Any Field" and set it to run manually from the Actions Menu. For the code use:


SELECT @All;
fname := @Prompt([OKCANCELEDIT]; "Enter Field Name"; "Enter the name of the field whose value you want to set. Note: This macro will only work if the field name is defined within the form."; "");
@If(fname = ""; @Return(0); "");
value := @Prompt([OKCANCELEDIT]; "Enter New Value"; "Enter the new value for this field. Leave blank to clear the value from the field"; "");
type := @If(value != "" & @Contains("0123456789.-"; @Left(value; 1));
@Prompt([OKCANCELLIST]; "Enter Data Type"; "What type of data is this?";
"Number"; "Date/Time" : "Number" : "Text"); "Text");
@SetEnvironment("Temp"; fname);
@SetEnvironment("Temp1"; value);
@SetEnvironment("Temp2"; type);
@PostedCommand([ToolsRunMacro]; "Set Value")

You will notice that it does call another agent called "Set Value."
This actually does the dirty work for you. This is the associated code for this agent:

SELECT @All;
value := @Environment("Temp1");
type := @Environment("Temp2");
@SetField(@Environment("Temp"); @If(value = ""; ""; type = "Number";
@TextToNumber(value); type = "Date/Time"; @TextToTime(value); value))

You can use this as a toolset available to you to correct an error in a document or to add to a database.

This was last published in June 2001

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close