If you have a drop down list on a page and want to place items into the drop down list dynamically, here is a bit of insight on how to do it.

 

This tip is taken from our discussion forum thread How to get drop-down list dynamically?


The SetEditTable method works with the ExecuteEdits method. It is used to set the value of a field on a record that has it's prompt table defined as %PromptField value. %PromptField values are used to dynamically change the prompt record for a field.

There are several steps to setting up a field that you can dynamically change its prompt table.

To set up a field with a dynamic prompt table:

Define a field in the DERIVED record called fieldname.

In the record definition for the field you want to have a dynamic prompt table, define the prompt table for the field as %PromptField, where PromptField is the name of the field you created in the DERIVED record.

For more information, see Creating a New Record.

Use SetEditTable to dynamically set the prompt table.

%PromptField is the name of the field on the DERIVED work record. RECORD.recordname is the name of the record to be used as the prompt table.

&MSG.SetEditTable("%EDITTABLE1", Record.DEPARTMENT);

&MSG.SetEditTable("%EDITTABLE2", Record.JOB_ID);

&MSG.SetEditTable("%EDITTABLE3", Record.EMPL_DATA);

&MSG.ExecuteEdits();

Every field on a record that has the prompt table field %EDITTABLE1 will have the same prompt table, such as, DEPARTMENT.