Help needed using the MRT server behaviours
hi there
In a previous post Eric kindly outlined how to use the MRT server behaviour as follows:
Here is the basic idea of how to use this server behavior.
1
Start on an insert or update page. You will first need to add a new recordset to your page to select the records from your secondary table, for example if you were configuring product options you would have a recoredset select all the records from your options table that you would like to associate with this product.
2
Once the recordset is in place on the page you will need to add the input to record the values of this secondary table. In regards to the example above you can add in a checkbox.
3
Next you will need to associate this new input with your new recordset. For the value you can bind the id from the new recordset, and for the label you can just use whatever value from the recodset would best reflect that record.
4
The next thing to go is to apply the repeat region server behavior to this new input and the label for it. In the repeat region server behavior make sure to choose your new recorset and let it display all records.
5
The final part is to add in the Manager Relational Table server behavior. When you add this server behavior you will fist need to specify the trigger and the relational table. For the trigger you can just use the button insert/update pressed. For the table make sure to select your relational table. Make sure you select the redirect page on this step.
On the next step you will select which column in your relational table will hold the id from your main table, you also need to select what type of data this will be and use the lightning bolt icon to select the id value that will be inserted here, it should be the id for the just inserted record held in the session varialble for an insert page and the id from the product recordset for an update page.
In the step after this you will select the column in the relational table that will hold the secondary table's id, like the previous step you will need to select the data type, for the value it should be defaulted to your repeat region input.
In step 4 of 4 you can set the value of the id or other columns in this table, if you have an auto incrementing id then you do not need to set a value for this column. You can finish it now to add the Manage Relational Table server behavior into your page.
When you test the page out you should see your newly added repeat region with the values from the recordset displayed. When you select these values and insert or update it should update your relational table.
-----------------------
I'm still struggling a bit with this, so could someone clarify in a more clearer way for me please.
I have three tables:
1. Products:
ProductID
name
desc
etc
2. Options:
OptionID
size
price
3. Lookup table
ProductID
OptionID
I have a standard DataAssist results page here:
products_Results.php
which links to the update page
and now would like to link this to add/update the various options.
Can you talk me through the first step on how to change this page to link it to the options page for each product please...
many thanks