Results 1 to 9 of 9

Thread: When a save is not a save

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2016
    Location
    Point Cook, Victoria, Australia
    Posts
    481

    Default When a save is not a save

    Hi,

    I'll try to keep this as simple as possible, although code-wise, it's not that simple.

    I have a header/detail (although in practice, it's really a 1 to 1 relationship). When the user presses <Shift-F2> or the <Delete> button on the toolbar and the header has the focus, the user is signifying that they wish to "mark" the header record as deleted. Today's date is saved in the header in a window called "Cancelled" and hopefully, this should be the end of it, however what I also need to do is mark the "Detail" record as deleted as well, however, I needed to set Cascade_Delete_State to False in an attempt to stop it deleting the detail record. I got around this - refer code:
    Code:
        Procedure Sync_Invoice
            If (Trip.Invoice_Id <> 0) Begin
                Integer iOrgMode
                Get_Attribute DF_FILE_MODE of Invoice.File_Number to iOrgMode
                Set_Attribute DF_FILE_MODE of Invoice.File_Number to DF_FILEMODE_DEFAULT
                Clear Invoice
                Move Trip.Invoice_Id to Invoice.Id
                Find EQ Invoice by 1 // Id (unique)
                If (Found) Begin
                    Reread Invoice
                    Move Trip.Job_Set_Id        to Invoice.Job_Set_Id
                    Move Trip.Job_Set_Ok        to Invoice.Job_Set_Ok
                    Move Trip.Job_Set_Send      to Invoice.Job_Set_Send
                    Move Trip.Job_Set_Sent      to Invoice.Job_Set_Sent
                    Move Trip.Sent_Date         to Invoice.Sent_Date
                    Move Trip.Last_Sent_Date    to Invoice.Last_Sent_Date
                    Saverecord Invoice
                    Unlock
                End
                Set_Attribute DF_FILE_MODE of Invoice.File_Number to iOrgMode
            end
            //
        End_Procedure
    In other words, by altering DF_FILE_MODE and then changing it back to its original setting when I was finished. Not the most elegant way of doing it.

    So, my question is, what is the best way to do this but still using <Shift-F2> or the toolbar's <Delete> button?
    Last edited by Rachael; 21-May-2020 at 04:22 AM.
    Regards,
    Rachael Warlond

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •