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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.