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 first published in June 2001

Dig deeper on Domino Resources - Part 7

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

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

SearchVirtualDataCentre.co.uk

Close