2 Replies Latest reply on Dec 5, 2012 11:14 PM by NilsMortenAlexandersen

    Loop problem

    NilsMortenAlexandersen

      Title

      Loop problem

      Post

           I am trying to achieve the following  (in FMP10)

            

           My database has a section for workshifts, that include Year, Week, Date Start and Date End fields

           PhilModJunk has kindly supplied me with a script that auto creates all posts for a year, with auto entry of Year and Week numbers. I also need a way to "Auto Create" the Date Start and Date End fields, to minimize manual typing.

           Date start is the start of the work week (Monday) . Date End is the last day of the week (Sunday). The Date End field is auto updated with  "Date Start + 6"

           I am trying to make a script that fills in the dates for me, with the following condition: I spesify the start Date Start field of week 1 manually. The date for next week is then the manually entered date + 7

           The DB also has a DATE TEMP field, that is global, used for copy and paste.

           The script is "kind of working" except that i get the entry of 07.01.0001 in every Date Start  field ... so I must be doing something wrong :-)

           Hope someone can help me

            

           Cheers Nils ...

      FMP_Script.jpg

        • 1. Re: Loop problem
          philmodjunk

               At the time this step executes in your loop:

               Set Variable [$DateNewWeek ; value: Turnus::Dato_Temp + 7 ]

               The value in Dato_Temp is zero. It does not appear to have global storage and this is not a field that you need anyway.

               Do the "+ 7" entirely in terms of your variable instead.

               Use these steps inside your loop:

               Set Variable [$DateWeek1 ; value: $DateWeek1 + 7 ]
               Set Field [Turnus::Dato_Start ; $DateWeek1 ]

          • 2. Re: Loop problem
            NilsMortenAlexandersen

                 Thanks a lot

                 As usual, I make things more complicated than it has to be :-)

                 Cheers :-)