Update - Final Solution and Guide
OK - I believe that I have everything working now and I hope that this information helps others to figure out how to use the Manage Relational Table (MRT) function of DataAssist.
In order for this to work you will need the following:
· 3 tables:
o One Master table for your main data (Main Table);· DataAssist Insert and Update pages created for the main data table.
o one table for the options that you would like to select (Options Table);
o and one table with three fields (unique ID, main table ID and option table ID) that will join the options to the main table items (Relational Table.)
Once you have created the tables and the DataAssist Insert and Update pages you need to take the following steps.
On the Insert Record page:
Your Options should now automatically update into your Relational with your main page records.
- Delete the $WA_redirectURL value from the insert record behaviour.
$WA_redirectURL = "redirectionpage.php"; will become: $WA_redirectURL = "";
This will be re-added to the MRT behaviour.- Create a Recordset that will retrieve all of the options that you wish to have displayed from your options table.
- Add a single checkbox that will be repeated to allow you to choose your options.
The checkbox “name” and “id” can be anything (suggestion: OptionBox)
The value of the checkbox will need to be set to echo the unique ID of the Options Table Recordset.
The Label for the checkbox should be changed to the applicable option name from the Options Recordset.- Add a repeat region to surround the checkbox and it’s label and have it repeat ALL of the options from the Options Recordset.
- Add the Multiple Relational Table Server Behaviour.
- On page 1 of the Wizard:
- Set the trigger to “Button: Insert Pressed”
- Select your Relational Table (joining table)
- Re-add your redirection page that you removed in step one.
- On page 2 of the Wizard:
- Set the “Foreign key column” to the main table ID from the Relational Table.
- Select the appropriate “Data type.”
- Set the “Key value” to echo the SESSION variable from the DataAssist Insert page (WADA_Insert_etc)
- On page 3 of the Wizard:
- Set the Foreign key column to the option table ID from the Relational Table.
- Select the appropriate “Data type.”
- The “Options Form Field” should automatically populate with the checkbox in your repeat region, if not then select it.
- On page 4 of the Wizard you should not need to make any changes unless you have additional bindings to insert into the Relational Table, so just click Finish.
On your update page you will need to repeat the previous procedure with the only difference being that the “Main Table Join” “Key Value” on page 2 of the Wizard will be set to echo the main ID from the main Recordset for the update page.
Do not forget to add a second delete behaviour to the Delete page which will remove the records from the Relational table when you delete the main item.
I hope this helps clarify how exactly the MRT works, if I need to make any changes or if you have any questions – post away. :o
For those that are interested - the issue I was having with records changing other records information was, I believe, related to the fact that my MAX_FILE_SIZE was too small and a file upload was failing and causing the INSERT to fail.