The #PROMPT$FN field
|Product/Release:||LANSA - All Platforms|
|Abstract:||Multiple fields sharing a common prompt function need to use the #PROMPT$FN field|
|Submitted By:||LANSA Technical Support|
In LANSA it is possible to attach several different fields to the same POP_UP function. However, the prompt function may need to know which field was prompted.
LANSA has a couple of special fields in the Repository which are always added to the exchange list when the prompt key (usually F4) is used:
PROMPT$FN = name of field being prompted (Type alphanumeric, length 10)
PROMPT$RN = name of reference field (Type alphanumeric, length 10)
For more details see What happens when the prompt key is used in the LANSA Technical Guide.
Two fields which can be used to hold a country code make use of the same POP_UP function. The first country code (#LNDCOD) has a Dutch description attached to it, the second country code (#LNDCD1) has an English description.
The POP_UP function which is called also returns the appropriate description (either #LNDOMS or #LNDOM2) plus the selected code.
On this screen both fields are displayed:
When field #LNDCOD is prompted, the selected value should be returned to this field only. This is achieved in the POP_UP function by using the Builtin function EXCHANGE_ALPHA_VAR. It is used to transfer alphanumeric fields to the exchange list (for numeric fields you would use the Builtin function EXCHANGE_NUM_VAR).
POP_UP FIELDS((#LNDCOD) (#LNDOMS)) USE BUILTIN(EXCHANGE_ALPHA_VAR) WITH_ARGS(#PROMPT$FN #LNDCOD) IF FIELD(#PROMPT$FN = LNDCOD) EXCHANGE FIELD(#LNDOMS) ELSE CHANGE FIELD(#LNDOM2) TO(#LNDOMS) EXCHANGE FIELD(#LNDOM2) ENDIF RETURN
The Builtin function used puts the value of field #LNDCOD into the field being prompted (= #PROMPT$FN). The result is that the contents of this field are transferred to the prompted field. In other words, only the first country code and description will be filled on the screen.