Hi
I'm trying to join two tables, hopefully via a drop-down menu. As an example the table structure can be reduced down to the following
tableA
tableA_ID: Number (a PK field)
tableB_ID: Number (a FK field)
tableB
tableB_ID: Number (a PK field)
name: String (some text)
There is a relationship between them defined as tableA::tableB_ID = tableB::tableB_ID
I have a layout for tableA and I would like to put a popup or drop-down menu in it that displays all the values from tableB::name, and when something is selected from this menu, it sets the tableA::tableB_ID to the corresponding tableB::tableB_ID value.
Currently I can achieve this via a button that performs a script that is as follows:
New Window [ Name: "TABLE B WINDOW"; Height: 500; Width: 500; Top: 50; Left: 50 ]
Select Window [ Name: "TABLE B WINDOW"; Current file ]
Go to Layout [ “TABLE B LIST” (TableB) ] // a layout that shows a list view of all the values of tableB::name
Pause/Resume Script [ Indefinitely ] // So the user can select a value from this list
Set Variable [ $tabB_ID; Value:tableB::tableB_ID ]
Close Window [ Current Window ]
Go to Layout [ original layout ]
Set Field [ tableA::tableB_ID; $tabB_ID ]
but this is a cludge - it looks unintuitive and awkward, and the user is required to click the continue button to resume the script. Any better solutions out there?
cheers
Stuart