close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Manage Relational Table - Working Tutorial?

Thread began 12/16/2010 10:44 am by Andrew Read | Last modified 5/10/2011 11:42 am by Jason Byrnes | 7056 views | 21 replies |

Andrew Read

Manage Relational Table - Working Tutorial?


Just wondering if there is a working tutorial for the Manage Relational Table (MRT) Server Behaviour? I have done some reading from the site and can't quite get it working. None of my checked items get inserted into the binding table.

I have three tables (Contracts, Venues, Link_CV.)

Contracts - contains contract information
Venues - contains venue information
Link CV - has unique ID and two fields "venue_ID" and "Contract_ID"

1. On insert page I have removed redirect URL from DataAssist insert behaviour.

2. I have created a looping checkbox set using a database query that retrieves all of the venues.

<?php $setRows=0?><?php do { ?>
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining $RepeatSelectionCounter_1_Iterations;
$RepeatSelectionCounterBasedLooping_1 || $row_getVenues){
          <div id="repeatBox">
              <input type="hidden" name="WADA_RepeatID_venue_id_<?php echo $RepeatSelectionCounter_1?>" id="WADA_RepeatID_venue_id_<?php echo $RepeatSelectionCounter_1?>" value="<?php echo $row_getVenues["venue_id"]; ?>" />
              <input <?php if (!(strcmp($row_getVenues['venue_id'],WA_AB_returnPreSelectValue($WA_PreSelect_RelationalTable_1$row_getVenues['venue_id'])))) {echo "checked=\"checked\"";} ?> type="checkbox" name="venueCheck[<?php echo $row_getVenues['venue_id']; ?>]_<?php echo $RepeatSelectionCounter_1?>" id="venueCheck_<?php echo $row_getVenues['venue_id']; ?>_<?php echo $RepeatSelectionCounter_1?>" value="<?php echo $row_getVenues['venue_id']; ?>"/>
              <?php echo $row_getVenues['venue_short']; ?></label>
          <?php $setRows++; echo $setRows; if ($setRows == 3) { echo "<br/>"$setRows=0; }?>
// RepeatSelectionCounter_1 Begin Alternate Content
No records match your request.
<?php // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
$row_getVenues && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining 0;}
$row_getVenues mysql_fetch_assoc($getVenues);
// RepeatSelectionCounter_1 End Loop
          <?php } while ($row_getVenues mysql_fetch_assoc($getVenues)); ?>

3. added MRT behaviour to page using:

Trigger - Button:Insert Pressed
DB connection
relational table set to link table
goto set to results page

Foreign key column - contractID from link table
data type - numeric
key value - set to created insert record id from contract table (WADAnsertRecordID)

foreign key column - linked table venue id
data type - numeric
options form field - wada repeat id venue id in repeat selection

no changes made

Something is wrong - maybe with the name or ids given to my looping checkboxes? Any help would be appreciated - and when this is working I will make a step by step guide for this as nobody else has done it yet. :)


Sign in to reply to this post

Jason ByrnesWebAssist

1) the name of the checkbox will create issues:
name="venueCheck[<?php echo $row_getVenues['venue_id']; ?>]_<?php echo $RepeatSelectionCounter_1; ?>"

should be:
name="venueCheck_<?php echo $RepeatSelectionCounter_1; ?>"

2) In step three, use the checkbox form element instead of the wada repeat id venue id hidden form element.

Sign in to reply to this post

Andrew Read

OK, I have started from scratch and now I am getting an error that the contract ID in the linked table can not be null - which it is not supposed to be.

It seems that it is not getting the value for the inserted record primary key from WADAInsertRecordID

This must be relating to the order that things are happening - the data for the primary table (contracts) is being inserted into the database, but this error pops up when trying to enter the data into the relational (adjoining) table.

Should the insert record primary key be available at this point for the MRT to use?

Sign in to reply to this post

Jason ByrnesWebAssist

I have no way of knowing with out seeing the code.

please compress your php file into a zip archive and attach it to your reply, once i have a copy o the page and can see the code, I will have an idea of where the problem may be.

Sign in to reply to this post

Andrew Read

Unfortunately I use WinRAR - so it is a RAR file and can't be uploaded - maybe you could add that extension.

Here is a link to it: link

Sign in to reply to this post

Jason ByrnesWebAssist

I'm on a mac and cannot open rar files.

Win rar can be used to save the archive as a zip:

Sign in to reply to this post

Andrew Read

Originally Said By: Jason Byrnes
  I'm on a mac  

Egad! No wonder these extensions have issues on the PCs... you're a Mac shop. :D

Here ya go.

Attached Files
Sign in to reply to this post

Jason ByrnesWebAssist

we test equally on Macintosh and PC.

The issue is that you have bound the cv_link_contractID column to the WADAInsertRecordID form element. you will need to use the WADA_Insert_contracts session variable instead.

the WADA_Insert_contracts session variable is created by the insert record server behavior to hold the ID of the record that it creates.

Sign in to reply to this post

Andrew Read

Originally Said By: Jason Byrnes
  we test equally on Macintosh and PC.  

I should hope so.. but that was a joke - notice that smiley... :D

Thank you for the help - it seems to be working now. On to the update DataAssist form, which should be a piece of cake now... ;)

However, the DataAssist delete form - how does one get it to delete all of the records pertaining to the link table when one deletes the main item?

Sign in to reply to this post

Andrew Read

Also, on my insert form when I insert a second (new) record it has the checkboxes from the last record pre-selected - where is this coming from and how can I have the checkboxes default to blank?

Thank you.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...