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

How can I get Multiple Insert, Update, Delete with MRT all working together??

Thread began 5/12/2010 4:44 pm by troyd | Last modified 5/17/2010 8:08 pm by troyd | 1280 views | 9 replies

troyd

Ok, I think I have it figured out and I wanted to share just in case someone else tries this. Keep in mind, I just fixed this, so I might encounter other problems but so far it's working.

The recordset that populates the Sub Category repeat selection (see second image above) had to be recreated as a JOIN so that I brought the dependencies in from the relational table. But my first attempt caused a problem. My first JOIN looked like this;

SELECT SubCategoryID, SubCategoryName, Parent_SubCategoryID
FROM tblSubCategories LEFT JOIN relCat_SubCat ON Parent_SubCategoryID = SubCategoryID


The above was wrong because my query showed multiples of each Sub Category name.

Food
Food
Food
Bowls
Bowls
Bowls
Toys
Toys
Toys

Since there were 3 records at the time, for each Sub Category in the relational table, it was showing me everything.

After some study, I figured out I needed to include a GROUP BY in my statement. So I changed it to this;

SELECT SubCategoryID, SubCategoryName, Parent_SubCategoryID
FROM tblSubCategories LEFT JOIN relCat_SubCat ON Parent_SubCategoryID = SubCategoryID
GROUP BY SubCategoryID


So now I get this;
Food
Bowls
Toys

(This was very exciting to discover. The more I learn about JOINS the more control I find I have over everything).

Then, on to the delete for the relational table. I did just as Jaffa suggested and added a second delete behavior. It's a multiple delete records behavior. I used the same delete checkbox as the key, just as the first uses. But I referenced the relational table and Parent_SubCatID column instead of the unique TableID column. So even though it's getting the SubCatID from the first table, it uses that same value anyway to then look into the Parent_SubCatID column on the relational table and delete how ever many rows use this value.

One thing I did have to do by hand is change some values in the second multiple delete behavior because it tries to name things to make the second tables column. For example, this line

php:
$WA_loopedIDField = array("WADA_RepeatID_Parent_SubCategoryID");



had to be changed to

php:
$WA_loopedIDField = array("WADA_RepeatID_SubCategoryID");


to match the hidden field used in the form, for the first delete. I guess I could have added a second one but I don't know if that would have worked. This did.

So anyway, using the MRT, I can now insert new Sub Categories with Categories assigned to them within the relational table, then with a second delete behavior, it's deleting from both tables just fine. I'll report back if there are any problems. And if anyone sees a better way for me to do this, please let me know.

Thanks,
TroyD

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

Content

rating

Layout

rating

Ease of use

rating

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...