en-USnl-NL
Goal:
Learn how to implement extentions that let work tables together.

General:
We want that  the "Activities" are linked to an "Activity Officer", and vice versa.
This requires the "Linking Extentions".
Linking extentions are designed to bring data from one table into another.
We will setup the link between the Activity table and the Officers table.
The link will create a dropdown list in both tables.
One way links the Officer to the Activity, the other way links the Activity to the Officer.
Linking extentions work in pairs, so pay attention to that.
In the table that SHOWS the DDL you have to use the "_DDL" extention; in the table that DELIVERS the content you have to use the "_SELSQL" extention.
Both extentions are located next to each other at extention numbers 1 and 2.

Ececution:
The extention for a dropdown list is called "_DDL", short for DropDownList.
First we set the _SQLSEL in the Activity table so an activitycan be selected from the Activitytable into the Officers record.
Start with opening the Activity tab in your DatabaseBuilder and make sure that the columns are visible by setting the columnwiths right.
   

Select and tick the extention gridcell in the _SQLSELcolumn in the row that shows the activity name.
This will force the ApplicationBuilder to create the code that is needed to attatch a dropdownlist to the Officers activity in the Officers table.
The dropdownlist will contain the content of this column.
Save your DatabaseBuilder for security now. Make a backup copy as well!

Now open the Officers tab in your DatabaseBuilder.
At this stage you must use the "_DDL" extention, but where do you have that to attatch to? Not to the Officers name......
Well, you have to introduce a new SQL field that hat to keep the Activity for this officer.
And since this activityname comes from the Activity table, the the SQL fieldname is the same as the Activity table name. Thus letting the ApplicationBuilder know where to retreive the data from.
Get the correct tablename in the Tables tab:
 
  Make the tablename the first part of the dropdownlist. Then append the use of the dropdownlist, but do NOT use any _ (underscore). This might bring touble because if your _ is followed incidentally by any combination of extention codes, you will get lots of errors.....

Tick the "_DDL" ExtentionGrid and select any other cell in your DatabaseBuilder. Observe what happens!
 
Because the application needs to know the recordindex of any linked record
the table must have this SQL field present. So the DatabaseBuilder inserts
this SQL field in the Activity table.

Done! You linked the Activity table to the Officers table.

You may do the same the other way round: Link the Officer able to the
Activity table


Now save your DatabaseBuilder again and make (another) backup copy.


Also again: re-build the modules Officers and Activities, because they have a new database model (i.e. new/changed SQL fieldnames.)
See lessons 9 and 10 for information.

Beware! This dropdownlist will show in ALL tables that have the _DDL extention ticked!

You're done with this lesson.


---->> Lesson 12: Testing an application