
A lookup field (also known as 'foreign key') is how AppGini links 2 fields from 2 tables together.
For example, let's say that our database contains a products table, a suppliers table, and a product categories table.
The products table stores data about each product, including the supplier
of the product, and the product category. Since suppliers and categories are stored in their own tables, the products table should look up those two tables
when storing supplier and category data for each product.
The products table is thus called a "child table", and it has 2 "parent tables":
suppliers and categories. So, we should create a field in the products table to hold supplier data, and another one to hold category data. Each of those two
fields is called a "lookup field". We can define its properties in the "Lookup field" tab in the field properties pane, which is shown above.
Lookup fields are also called "foreign key" fields.

The above screenshot shows the detail view of the products table as generated by AppGini.
The detail view is where users can edit records of the table. The "Supplier" and "Category"
fields are lookup fields that bring their data from the suppliers and products
tables, respectively. This data is represented in a drop down menu for each
field.

To set a field as a lookup field in AppGini, create a new field and, in its properties pane,
go to the "Lookup field" tab, as displayed in the above screenshot. From
the "Parent table" drop down, select the table that contains the source data.
From the "Parent caption field part 1" drop down, select the source field.
You can optionally specify a second source field to be joined to the first one. For
example, you could create a lookup field that lists the full name by joining a "first name"
field to a "last name" field, using a space as the separator.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note: AppGini will change the data type of the lookup field to be the same as that
of the primary key of the parent table. This is normal behavior and you shouldn't alter it.
If the parent table doesn't have a primary key yet, you should change the data type of the lookup
field manually to match the primary key once you create one.
© Copyright 2002-2005, BigProf Software. All rights reserved.