1 Reply Latest reply on Jan 2, 2012 4:26 PM by philmodjunk

    Repeating Field - Set Field as a batch over repeating field

    jebber6685

      Title

      Repeating Field - Set Field as a batch over repeating field

      Post

      I have a repeating field of dates.

      I want to create a script that will fill all the repeating fields with the date starting with the first repeating field as the current date and then adding 1 day to all the following repeating fields until they are all falled with a sequence of dates. 

      I can do this with a sequence of Set Field inputs;

      Set Field [ repeating field (1); Get(CurrentDate)

      Set Field [ repeating field (2); Get(CurrentDate + 1)

      Set Field [ repeating field (3); Get(CurrentDate + 2)

      etc......

      Is there a way to do this as a batch with just one entry and then it will go through all the interations until all the repeating fields are filled?

      Any help here would be greatly appreciated.

      I have FMPro Advanced 11.0 v3
      OS - Windows Vista on desktop, Windows 7 on laptop

       

        • 1. Re: Repeating Field - Set Field as a batch over repeating field
          philmodjunk

          A loopeing script with a variable used for the repetition number can do this, but why?  Repeating fields are usually not the best option for you data in today's FileMaker. Usually, another structure--such as a table of related records works better.

          Here's the script, but keep in mind that it's working with a data structure that probably is not the best option for your database:

          Loop
            Set Variable [$K ; value: $K + 1]
            Exit Loop If [$K > /* put max number of repetitions here */ ]
            Set Field [YourTable::RepeatingField [$K] ; Get ( CurrentDate ) + $K - 1 ]
          End Loop