AnsweredAssumed Answered

Calculations break when Creating New Records from Related Table

Question asked by ClaireCollin on Apr 26, 2013
Latest reply on May 2, 2013 by philmodjunk

Title

Calculations break when Creating New Records from Related Table

Post

     I used the script below to create new records from one table [Production] into another [NEW].

     Go to Layout ["Weeks" (NEW)]
     Show All Records
     Delete All Records [No Dialog]
     Go to Layout ["Production" (Production)]
     Sort Records [Restore;no dialog]
     Go to Record/Request/Page [First]
     Loop
        If [Production::Mark ≠ "x"]
            Set Field [NEW::Unique; Production::Unique]
        End If
        Go to Record/Request/Page [Next; Exit after last]
     End Loop

     The tables are related by
     NEW::SKU<>Production::SKU
     NEW::Unique<>Production::Unique

     This works and brings in the correct number of records but the calculations that were working when I imported records no longer work when I use a script to create the records instead. Is there a way to have the script copy over the field information when it creates the new record rather needing to use calculations?

     I can use calculations to fill in the Name and Week fields but the calculations to fill in Shipping and Availability, which are based on the week, only fill in information for the first week. Any thoughts would be helpful.  I have tried changing the relationships as well as the calculations themselves but nothing I've tried seems to work.

Outcomes