Thursday 17 April 2014

Dynamic Prompt / Edittable Prompt

The following steps help to make Dynamic prompt (Edit Table Prompt).
Lets consider a scenario, based on selection Criteria the Character value prompt need to change.
For Department Character value prompt should be DEPT_TBL and for Job Code the Character value prompt should be JOBCODE_TBL.
image
Now consider the design.
image
The Selection Criteria, Character Value, Process are fields in SQL Record (May change in different case) and Edit Table(EDITTABLE field) is from DERIVED (delivered) derived and work record.
in the above  example your need a record(e.g GR_CRI_TBL) has following fields
SELECTION_TYPE
CHAR_VALUE
PROCESS
CHAR_VALUE should have %EDITTABLE Prompt Table Edit Type
image
Write the following function in any FIELDFORMULA and call the function as given below.
Local string &Type;
Function hide_unhide_popfields(&Row As Row);
   &Type = &Row.GetRecord(Record.GR_CRI_TBL).SELECTION_TYPE.Value;
   Evaluate &Type
   When "D" /* Department */
      &Row.GetRecord(Record.DERIVED).EDITTABLE.Value = Record.DEPT_TBL;
      Break;
   When "J" /* Job Code */
      &Row.GetRecord(Record.DERIVED).EDITTABLE.Value = Record.JOBCODE_TBL;
      Break;
   When "L" /* Location */
      &Row.GetRecord(Record.DERIVED).EDITTABLE.Value = Record.LOCATION_TBL;
      Break;
   End-Evaluate;
End-Function;
Call the above function based on FieldChange and RowInit.
 
Declare Function hide_unhide_popfields PeopleCode GR_CRI_TBL.SELECTION_TYPE FieldFormula;
SetDefault(GR_CRI_TBL.CHAR_VALUE);
hide_unhide_popfields(GetRow());

No comments:

Post a Comment