5 Replies Latest reply on Dec 11, 2012 2:44 AM by comment

    Script for a repeating field

    carfiles

      Repeating Field Question.

       

      I have a repeating Date field numbered from 1-72 in which I post payment dates from my clients. I would like a script that will highlight the last date field with an entry in it. Because of space constraints I have placed this fields inside a tabbed panel with 6 tabs, in each tab I have placed 12 repeating fields for a total of 72. I have a field that shows the last payment by way of Last(Payment), but that is not what I need. Thanks...Gary

        • 1. Re: Script for a repeating field
          comment

          carfiles wrote:

           

          I would like a script that will highlight the last date field with an entry in it.

           

          Assuming the entries are in chronological order, you could use conditional formatting =

           

          Self = Last ( Payment )

           

           

          ---

          You should consider using individual records in a related table instead of repeating fields.

          • 2. Re: Script for a repeating field
            carfiles

            Thank you Michael for your prompt answer. The conditional formatting works great to highlight the last field used. However, I guess, I did put the question right. I really need a formula for a script that will actually enter that last field, that in return would bring forward the tab in which the field is hiding behind. Right now I would have to click on each tab one a the time until such field is revealed. This is an existing file with a lot of records in it, and it would be hard to reformat it at this point in time. I noticed by reading other comments that nobody seems to like repeating field too muck. Thanks

            • 3. Re: Script for a repeating field
              comment

              carfiles wrote:

               

              I really need a formula for a script that will actually enter that last field, that in return would bring forward the tab in which the field is hiding behind.

               

              For what purpose? You can bring the correct tab to front simply by calculating =

               

              Div ( Count ( RepeatingField ) - 1 ; 12 ) + 1

               

              In your example, this will return a number between 1 to 6, which you can then use in a Go to Object [] script step to go to the corresponding tab (after having assigned object names to the tabs).

               

               

               

              ---

              If you really want to insert the cursor into the last repetition, you could just call the Go to Field [] step, specifying Count ( RepeatingField ) as the repetition to go to. IIRC, this will automatically select the relevant tab too.

               

               

               

              Message was edited by: Michael Horak

              • 4. Re: Script for a repeating field
                carfiles

                I took your advise and went after the tabs instead, here is the formula I used in my script:

                 

                If [ Count(My Data Base::Payment Date)<13]

                Go to Object [Object Name: Tab1]

                 

                Else If [ Count(My Data Base::Payment Date)<25]

                Go to Object [Object Name: Tab2]

                 

                Else If [ Count(My Data Base::Payment Date)<37]

                Go to Object [Object Name: Tab3]

                 

                 

                End If

                 

                Of course I have six tabs so I added a few more Else Ifs. Works perfect...thanks

                • 5. Re: Script for a repeating field
                  comment

                  carfiles wrote:

                   

                  Of course I have six tabs so I added a few more Else Ifs.

                   

                   

                  As I tried to say, you could do this with a one-liner:

                   

                  Go to Object [ "Tab" & Div ( Count ( My Data Base::Payment Date ) - 1 ; 12 ) + 1 ]