Wednesday, March 9, 2011

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());




4 comments:

Josue Rodriguez said...

very useful! this solved my problem. thanks!

EduardoCR said...

Hi, Pawan, useful!!!, but I have an additional challenge, how do I display images from one table that I want to use like Prompt Table?
PS-AppDesign doesn't let me define an image like a field of List Box Item at Record Field Properties. Do you have something?
Any Help will be apreciated.

Thanks

Pawan Mundhra said...

You can have a look over "Navigation Collection" Component and pages. May be related for your problem.

Santosh Tripathi said...
This comment has been removed by a blog administrator.

Post a Comment