2 Replies Latest reply on Aug 6, 2015 10:22 AM by FilmUser

    Script trigger with repeating field set.



      Script trigger with repeating field set.


      I have 3 repeating fields (I might rather do this another way, but because of some things about this database I’ve inherited, I need to use repeating fields) for tracking shipping of documents.

      The fields are: Tracking Number (as in UPS, etc.), Date shipped, and person who shipped it.

      All three fields are repeating up to 4 repeats. The objective is to have the date self-populate with the current date, and the person who shipped to the Account Name, when the Tracking Number is entered.

      Since there may be as many as 4 of these events, I want the repeats in each field to associate.

      My first effort was with a script trigger based on entry into the Tracking Number field, the script setting the other two fields, which works for the first repeat, but the second Tracking number will over-write the first date and person shipping.

      The “set field” script step can be made to select a repeat in the target field, but not the trigger which is fired by the Tracking number.

      I also tried making the Date and Person shipping calculations based on the Tracking Number field being “not empty”, which works, but seems to change depending on whose computer is viewing the data.

      Any suggestions?

        • 1. Re: Script trigger with repeating field set.

          The best option is to get rid of the repeating fields. If you use a portal or portals to a related table with one portal row in place of each repetition, this problem will no longer exist. It's relatively easy to convert a set of repeating fields into a set of related records using import records.

          But if you insist on repeating fields, the Get ( ActiverepetitionNumber ) function can be used by your script to determine what repetition to modify with the current date.

          • 2. Re: Script trigger with repeating field set.

            Thanks, Phil, I knew I was in for the "if you insist", and I agree. I'll have to work on the original owner of the data base.

            But thanks for the alternate solution. It sounds like what I was looking for.