Change field values from a view

Ever need to change a few values in a document that can't be changed via the form because the fields are not there

or are set to hidden or computed? Usually this means we have to open designer and write an agent to change the values. This tip explains how to setup a smart icon that lets you change any field's value right from the view without creating an agent.

Put the code below into a smart icon's action formula. When you have a document selected and click the smart icon, a dialog box will popup letting you choose from a list of fields inside the document. Select a field and the next dialog box shows you the current value, which you can then edit. As a bonus, if you type in @Delete as the value, the field will be removed from the document.

Note this always changes the value to a text field, so be careful not to change any number or time/date fields.

By the way, you can input multi-values by separating each value with a semicolon.

REM "Change Field Values From A View";

tmpFields := @DocFields;
tmpLastFieldChosen := @Environment("SI_LastFieldChosen");

tmpChangeField := @Prompt([OKCANCELLIST]; "Change Field"; "Please choose the field whose value you'd like to change"; tmpLastFieldChosen; tmpFields);

REM"Save State"; @SetEnvironment("SI_LastFieldChosen"; tmpChangeField);

tmpValue := @Prompt([OKCANCELEDIT]; "New Value"; "Please enter the new value for the field or type @Delete to delete the field."; @Abstract([TextOnly]; 200; ""; tmpChangeField));

@If(tmpValue = "@Delete"; @SetField(tmpChangeField; @DeleteField); @SetField(tmpChangeField; @Trim(@Explode(tmpValue; ";"))))

This was first published in April 2001

Dig deeper on Domino Resources - Part 3

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