GeneXus includes referential integrity controls in programs related to transactions (and business components), in addition to generating selection lists that prove quite useful for inserting and updating related data.
What is a selection list?
A Selection List is a Panel (Web, Win or SD) created automatically by GeneXus to provide end users with the possibility of querying the data existent in a specific table in the database in order to select certain data, returning its identifier.
For instance, when a user executes the web transaction “Customer”, in order to edit a specific customer whose identifier is not at hand, it is possible to select the customer through a panel showing all customers. If upon entering a customer’s country (CountryId attribute, foreign key) we ignore the values of the countries entered, we can activate a selection list that will enable us to query all the countries on the COUNTRY table and select the one we want.
When generating for web or for win, for each primary key and for each foreign key in a transaction we will have the corresponding selection list.
Example: In the web transaction, to select a customer´s country in runtime we click on the image to the right of the CountryId attribute:
When generating for Smart Devices, selection lists will be created exclusively for the foreign keys present in the (General)Section of the corresponding Work With (since in Smart Devices, the location to interactively enter/modify the table’s information is not the transaction but rather the (General)Section of WorkWithDevices<Transaction>).
Example: to select a customer’s country (customer that was previously selected from the Work With Customers):
Note: selection lists associated with a transaction’s foreign keys are usually called prompts; and we usually call the selection list associated with the primary key (only in web/win) under the name autoprompt. However, this is just a terminology difference since they are the same objects reused as prompt or autoprompt, depending on whether we invoke them, respectively, for a foreign or a primary key.
More on Selection Lists: