Changes a default prompt automatically called in a Transaction object or Work With for Smart Devices object Section(General)/Edit layout. It also allows invoking a prompt for a secondary attribute or a variable, to help the user with the selection of a valid value.
If the Prompt rule references several out parameters, at least one of them must be enabled in the Form; otherwise the Prompt rule will not be enabled.
Prompt(objectName, parmx [, parm1, .... , parN]) [ on ctrl ] ;
It's the name of the called object (it must be a Web Panel, Panel, or Work Panel, returning at least a parameter).
It's the attribute or variable for which the user needs to select a value through the prompt. If it is a compound foreign key, you have to specify the attributes that compose the foreign key separated by a comma.
parm1, .... , parN
Optional parameters that can be sent to the called object (and must be received there) for some purpose (I.e: for filtering in the prompt and showing only certain records that fulfill with a condition).
Is the control associated with the prompt.
Transactions offer automatically in their forms a prompt or selection list for each foreign key, by pressing the arrow icon offered aside each Foreign Key. They also offer another prompt by pressing the magnifying glass icon offered in the form above all. Similarly, when editing in a mobile application an element previously selected from the List of a Work With <Transaction>, a prompt will be offered on each FK attribute. That is, each WorkWith<TransactionName> offers in its Section(General)/Edit Layout prompts for each FK.
If the attributes indicated as parameters compose a foreign key and there is an automatically generated prompt based on this foreign key, the object indicated in the prompt rule is called instead of the prompt generated by GeneXus.
As the syntax shows, the Prompt rule allows you to (optionally) specify a Web or mobile interface, the name of the control associated with the specific prompt you want to call. The possible controls for the web objects are those which have the link property (TextBlock, Image, etc.). For the mobile apps, the possible controls are the ones that can have an associated Tap Event.
If ‘on Ctrl’ is omitted, an image, button, etc. will be added (in the corresponding environments) to the right of the field(s) with prompt, as it has occurred so far.
Use of prompts on foreign key attributes
Form: a grid with Base Table CUSTOMER, necessarily containing the CustomerId attribute (either visible or invisible).
&CustomerId = CustomerId //the selected value is charged in the parameter to be returned
Note: This example shows the prompt rule applied to a Transaction, but it can be used in a Web Panel. Suppose you define a variable &customerId with the same data type as CustomerId. If you specify in the Web Panels Rules section:
the prompt icon will be displayed next to the variable in the form, allowing the user to select the customer from the CustomerSelection object.
If the prompt has more than one out parameter, the prompt icon will be displayed in the last one of the parm rule.
The attribute, StudentGender, is not a foreign key, but it must comply with its defined value range ('F' / 'M'). The Web Panel 'GenderSelection' displays the two possible values, and either value can be selected. This prompt is activated when you press the icon offered aside from the attribute StudentGender.
Similarly, having the Panel 'GenderSelection' and the above prompt rule in the Rules section of the WorkWithStudent/Section(General)/Edit layout, when trying to insert/modify a student through this layout at runtime, the StudentGender attribute will have the possibility to activate the 'GenderSelection' prompt in order to select the desired one.
Note: These examples show how to use the prompt rule on a non-FK attribute inside a Transaction or WW Section(General)/edit. But the same can be done using a variable (&gender) in a Web Panel or Panel for Smart Devices, to be loaded from the called prompt object.
The Prompt rule does not execute server-side events (Web Panels: Start event, Refresh event and Load event; Transactions: Start event and Exit event), except that it uses parameters encryption (Encrypt URL parameters property). When encrypting parameters, server-side events are executed.
When you call a prompt (popup) with the GET method, you don´t have control over the maximum URL length. Each browser solves it differently: