4 Replies Latest reply on Jul 9, 2012 8:13 AM by neilgalang

    NEEED HEEEEELP in Making child records unaffected by Parent Record data changes

    neilgalang

      Title

      NEEED HEEEEELP in Making child records unaffected by Parent Record data changes

      Post

      Hi,

       

      I have been explaiing the function of a parent-child relationship to my boss but he insitis he wants the child records generated from parent records "BE LOCKED" or unnafected once they are duplicated from the parent.

      I use a loop script and set field to duplicate sorted records (published in IWP)  Here is the scenario:

       

      1) User clicks a button to sort out desired set of records from parent table called (DEFAULT TREATMENTS)

      2) script sorts out records, creates duplicates (children) on a separate table called (DAILY TREATMENTS)

      3) what my boss wants is to LOCK the DAILY TREATMENT records so that any changes that we do in the default will not reflect on the "published" daily treatments.

       

      Is there a way to lock these records or to make them uneditable or unaffected by parent reocrd changes? All help and replies will be GREATLY appreceiated....Thank you!

        • 1. Re: NEEED HEEEEELP in Making child records unaffected by Parent Record data changes
          philmodjunk

          As I understand the process, changes to records in the Default Treatments table will not have any effect on the records in daily treatments as you have it set up now. Since you appear to be copying the data from one table to the other, why would changes in default treatments have any effect on Daily Treatments?

          This is a very similar scenario to invoicing systems where you need to be able to modify prices and tax rates without changing the data in existing invioces--the changes should only affect new invoices. And this is done by duplicating the data in question instead of just creating a link to it.

          • 2. Re: NEEED HEEEEELP in Making child records unaffected by Parent Record data changes
            neilgalang

            Thank You for the quick reply. Maybe I made a mistake in my script or how I laid out my fields?

             

            Here is my script:

            Rx_Items::Rx_Items_PK = DailyCompleted_Rx::Rx_Items_FK

            Go to layout (Rx items)

            Perform Find [restore]

            Go to Record/request/page [first]
            Loop
                    Set variable [$Rx_Items ; value: Rx_Items::Rx_Items_PK]
                    Go to Layout [DailyCompleted_Rx]
                    New Record/Request
                    Set field [DailyCompleted_Rx::Rx_Items_FK; $Rx_Items]
                    Go to Layout [Rx_Items]
                    Go to Record/request/page [next; exit after last]
            End Loop

             

            my question now is, how does this script go about in creating the record? What i did was I copied  the fields from my Rx Items (Default Rx Plan) and pasted them into the Daily COmpleted Layout so that the "set field" command has something to write to. SO, it's one and the same field as the original layout---is this where I made a mistake? How do I set the layout for my Daily Treatment plan? 

            Thanks!!!

            • 3. Re: NEEED HEEEEELP in Making child records unaffected by Parent Record data changes
              philmodjunk

              My database uses a very similar script for "loading" an invoice with the 4 most common types of used beverage containers that customers bring in here for recycling. The current unit redemption and scrap values are copied from the table of materials into the line item records it creates.

              Your script correctly creates a new record in DailyCompleted_Rx with an FK value that matches the PK of a record from your found set of Rx_Items records.

              The key detail you need to check is not in the script, but in the field options for the other fields in DailyCompleted_Rx. They should be set up with auto-enter options that copy data via this relationship from corresponding fields in Rx_Items. This can be either an auto-enter calculation or a looked up value setting.

              You can find these options and change them if necessary, if you follow these steps:

              Open Manage | Database | Fields and select DailyCompleted_Rx from the tables drop down.

              Find or create a field for a vale in DailyCompleted_Rx that will hold a value copied from Rx_Items. With this field definition selected, double-click it or click the options button to open the Field Options dialog.

              Click the Auto-Enter tab.

              Use either the "calculation" or "Looked up" value options to set it up to copy data from the corresponding field in Rx_Items.

              • 4. Re: NEEED HEEEEELP in Making child records unaffected by Parent Record data changes
                neilgalang

                Thank You Kind SIR!

                 

                The script is flawless, and your suggestion with the lookup values work fine as well-- We tested the EMR this morning and it got approved, and we already acquired our copy of Filemaker Server Advanced for deployment this week. 

                As I have mentioned earlier, this application will save so much time in therapy minutes and will help allocate healthcare funds more appropriately.  We wouldn't have done this without you.