Alpha Developers Network

Guest


Author Topic: Deletions for relational DB (Repeating sections)  (Read 500 times)

0 Members and 1 Guest are viewing this topic.

Jwemmy

  • Guest
Deletions for relational DB (Repeating sections)
« on: November 12, 2012, 03:18:00 AM »
Hi all,

I've been frying my brain on this subject for a couple of days now, so would appreciate any help / pointers you can give me.

Here's the basics.  I have Alpha web v11, but am new to the associated technologies - e.g. SQL, Ajax, Javascript etc.

My first trial forays into web development went pretty well.  I set up a MySQL database and can administer it with MySql Workbench.

I created some trial components / a5w pages - culminating in my first useful app. which addresses Customers with Contacts in a
1->Many relationship.  From a Customers grid, I've used action buttons to call Dialogs to add and update Customers and Contacts (using repeating sections).  See attachment.

Alpha seems to have all this in hand, using Defined controls which 'genie-fy' the choices and elimiate the need for the developer to understand server side coding in Ajax.

However, I fell flat on my face when trying to achieve a similar approach to deleting Customer records.  My view is that if the user deletes a customer, they're going to want to also delete their associated contacts - so I set about creating an Action button that would call a routine (or Dialog) to show the data, ask for a confirmation and then delete the Customer record and it's related Contact records.

To my great surprise, this topic seems to have been skipped over.  There are some very convoluted video examples on the Alpha repository which are aimed at power users, and which appear to handle this area - but as I'm new to the subject I struggled to understand them - and failed !

Have I missed an easy trick - is there indeed a deletion genie that I've failed to spot ?   ???

If not, I'd appreciate any advice you can give on how to incorporate some code / sql commands to achieve my task above.

Thanks in advance !

Jem Cotton


Steve Wood

  • Administrator
  • Expert
  • *****
  • Posts: 706
  • Karma: +11/-0
    • AlphaToGo
  • Real Name: Steve Wood
Re: Deletions for relational DB (Repeating sections)
« Reply #1 on: November 12, 2012, 09:43:45 AM »
No genie in this area. You need to write the SQL/Xbasic to delete the appropriate records in parent and child. If you are using SQL it is possible to program in cascading deletes and other referential integrity.
---
Steve Wood
www.alphatogo.com

Jwemmy

  • Guest
Re: Deletions for relational DB (Repeating sections)
« Reply #2 on: November 12, 2012, 03:21:03 PM »
Hi Steve,

Thanks - I'm going to spend some time tomorrow looking into cascading deletes etc. in MySQL.

It does seem a pity though that the good folks in AlphaDevelopmentLand didn't build in a Dialog with a Delete facility.

Cheers Jem