Changes a default prompt automatically called in a Transaction object or Work With for Smart Devices object Section(General)/Edit layout. It also invokes a prompt for a secondary attribute or a variable, to help the end-user with the selection of a valid value.
Prompt(objectName, parmx [, parm1, .... , parN]) [ on ctrl ] ;
Where:
objectName
Is the name of the called object (it must be a Web Panel, Panel, or Work Panel, returning at least a parameter).
parmx
Is 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).
ctrl
Is the control associated with the prompt.
Objects: Transaction,
Web Panel,
Work With for Smart Devices,
Panel
Generators: Web, Smart Devices
For each Foreign Key, Transactions automatically offer a prompt or selection list in their forms, by pressing the arrow icon offered next to them. They also offer another prompt by pressing the magnifying glass icon offered in the form above all. Similarly, when editing an element previously selected from the List of a Work With <Transaction> in a mobile application, 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.
Notes:
- If the Prompt rule references several out parameters, at least one of them must be enabled in the Form; otherwise the rule will not be enabled.
- 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 and 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.
Use of prompts on Foreign Key attributes:
Transactions:
Invoice Customer
{ {
InvoiceNumber* CustomerId*
InvoiceDate CustomerName
CustomerId }
CustomerName
InvoiceAmount
}
Rules for Invoice:
prompt(CustomerSelection,CustomerId);
Web Panel CustomerSelection:
Rules:
Parm(inout: &CustomerId);
Form: a grid with Base Table CUSTOMER, necessarily containing the CustomerId attribute (either visible or invisible).
Events:
Event Enter
&CustomerId = CustomerId //the selected value is charged in the parameter to be returned
Return
EndEvent
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:
prompt(CustomerSelection, &customerId);
the prompt icon will be displayed next to the variable in the form, allowing the end-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.
Use of prompts on NON-foreign key attributes
Transaction Student:
Student
{
StudentId*
StudentName
StudentGender
StudentAge
StudentAdd
}
Rules:
prompt(GenderSelection, StudentGender);
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 of them can be selected. This prompt is activated when you press the icon offered next to 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.
Notes:
- 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:
- https://stackoverflow.com/questions/4618013/414-request-uri-too-large-is-this-browser-dependant
- https://support.microsoft.com/en-us/help/208427/maximum-url-length-is-2-083-characters-in-internet-explorer
Refcall rule
Refmsg rule