Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, February 23, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Correct cascading rules for a M:M table
Mark Hanford
Posts: 131
 
Correct cascading rules for a M:M tableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 12 5:55 AM
fiogf49gjkf0d

Hello folks,


I have a simple requirement for a M:M table "MARKET" that will be linked to "ACCOUNT", using a join-table "ACCOUNT_MARKETS".


Whenever I delete an ACCOUNT, the related ACCOUNT_MARKETS should be deleted, but not the MARKET.
Whenever I delete a MARKET, the related ACCOUNT_MARKETS should be deleted, but not the ACCOUNT.


To achieve this, I have created the relevent tables, and then two joins like this:


Parent Table: Account, Parent Field: AccountID
Child Table: Account Markets, Child Field: AccountID
Type: Left
Cascade: Delete (stop)


Parent Table: Market, Parent Field: MarketID
Child Table: Account Markets, Child Field: MarketID
Type: Left
Cascade: Delete (stop)


However, on my "Manage Markets" view, when I delete a market, the corresponding ACCOUNT_MARKETS records are not deleted.


Should those joins not ensure the data is deleted in the join table?


Thanks,


Mark


(Currently using SalesLogix 7.2.1)

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Correct cascading rules for a M:M tableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 12 8:53 AM
fiogf49gjkf0d

SLX has always been AccountID centric.  I also note that you are on buggy version that has had dozens of fixes and a bunch of service packs since.....7.2.1? You've got to be kidding me, it's April 2012.


 


1. Do the delete's yourself. Turn off the autojoin cascading delete's for this M:M relationship.


2. Don't let SLX delete the item's for you.


3. Script multi level deletes record by record.


 


When was Application.BasicFunctions.CascadeDelete fixed? This was a hot fix in 7.2.2 right?

[Reply][Quote]
Mark Hanford
Posts: 131
 
Re: Correct cascading rules for a M:M tableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 12 8:56 AM
fiogf49gjkf0d

Yeah, we're well behind. I've been pushing for an update for some time, but we have a lot of customisation and integration, so it's going to be an expensive project.

[Reply][Quote]
Mark Hanford
Posts: 131
 
Re: Correct cascading rules for a M:M tableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 12 9:31 AM
fiogf49gjkf0d

I'm looking at implementing my own cascading delete, so I'm trying to hook into the OnDeletedRow event of the datagrid.  How do I get at the ID of the deleted record?


Thanks,


M

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Correct cascading rules for a M:M tableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 12 9:42 AM
fiogf49gjkf0d

Step 1: turn off the out of the box Delete grid row option


Step 2: add your own Popup Menu option to the grid to handle deleting the 'entity'


Step 3: trap the popup menu option(item caption or item number)


Step 4: get the Id of the selected rows.......(multiselect is always a good thing for the user's???).


 



Sub dgTerritoryByAccountPopupMenuClick(Sender, Item)
   '''  MsgBox Item.MenuIndex

   '' Account Territory delete row(s) per user selection of grid rows.
    If Item.MenuIndex = 3 Then
        Dim strAccountTerritoryID
        Dim I
        For I = 0 to Sender.Selection.Count - 1
            strAccountTerritoryID = "" &  sender.Selection.Item(I)
            If strAccountTerritoryID > "" Then
                Application.BasicFunctions.CascadeDelete "ACCOUNTTERRITORY", strAccountTerritoryID
                Call cmdSearchClick(cmdSearch)
            End If
        Next
        Application.BasicFunctions.RefreshMainView  ''' need to recount Account Territories.
        Exit Sub
    End If

    '' AccountID jump to.
    If Item.MenuIndex = 4 Then
        DIM strAccountID
        strAccountID = sender.getcurrentfield("ACCOUNTID")
        If strAccountID > "" Then
            Application.BasicFunctions.SetCurrentAccountID strAccountID
        End If
    End If
End Sub

[Reply][Quote]
Mark Hanford
Posts: 131
 
Re: Correct cascading rules for a M:M tableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 12 9:46 AM
fiogf49gjkf0d

Ah, okay thanks. I've used custom menu's like this before so should be able to get that working okay - I was hoping there was a magic way of getting record info out of the event handler.


Thanks


M

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/23/2025 7:35:08 AM