Truncate Related Records

Idea created by oceanwest on Jul 20, 2018
    • jrenfrew
    • Hemant Kumar Patel
    • Jens Teich
    • oceanwest
    • Johan Hedman
    • Vincent_L
    • SteveNoble
    • jormond
    • BowdenData

    It would be nice to have a single script step Truncate Related Records


    Currently if you want to delete all related records you need:


    • test to see if related records exist or FAIL
    • GTRR to the related records targeting some layout with out triggers, trap for errors (missing layout) and FAIL
    • delete all records - trap for errors - (locked parent record, if open in card, open records?) and FAIL
    • wrap this in some more error trapping.
    • navigate back to original layout.
    • refresh


    Truncate Related Records  [  With dialog: (on|off) ; Layout: <current layout> ; From table: <RelatedTableName> ; Filter: <calculation> ; Cascade: <boolean> ]


    something like this will pre flight to determine if your in the correct context and relationship exists and related records exist and could even include an on the fly relationship only delete the related records based on the calculation (like filtering a portal)



    If standing on a Invoice Record and you wish to purge all related records from notes > 90 days old and also any attachments.


    Truncate Related Records

          [ With Dialog: On ; Layout: Invoice Details ; From table: INV_InvoiceNotes ; Filter: Calculated: ( Get(CurrentDate) - INV_InvoiceNotes::Date - > 90 ) ; Cascade: $all ]


    The dialog would indicate immediate 12 record and 3 additional record other related tables (only if the relationship has cascade delete enabled.


    By allowing Cascade as a boolean you could programmatically decide when it's appropriate.

    Layout: could include "Layout Name By Calculation" and  "Layout Name by Number"

    From Table: would need to be indirectly selectable not something we have as current equivalent.