3 Replies Latest reply on May 28, 2010 1:12 AM by comment_1

    Self function on repeating field

    ptt555

      Title

      Self function on repeating field

      Post

      I know repeating fields are far from everyone's favorite, but have enabled me to create a functional 'graphical' gantt  chart.

      Conditional formatting of the blocks on the gantt chart is working great, with the exception of each field on the layout requiring me to manually reference which repetition will trigger the formatting.

       

      example:  Using the 5th repetition for the conditional format, this syntax works

      Formula is...  graphicbook::d18[5] = 2

      but the formula must be set up field by field manually

      Formula is...  graphicbook::d19[5] = 2

      etc

       

      I've attempted with no success syntax such as:

      Formula is... self[5] = 2

       

      Also attempting Let statements

      getrepetition (self ; 5) 

      FM doesn't seem to like the 'self' reference with getrepetition

       

      Finding a way to use the 'self' or similar function could save some significant time on both my layouts and scripts.

      Any guidance?  Simple syntax error on my part or a functionality not available in FM?

      As always, thanks in advance for any/all assistance. 

       

       

        • 1. Re: Self function on repeating field
          comment_1

          You could try =

           

           

          GetField ( "GetRepetition ( " & GetFieldName ( Self ) & " ; 5 )"  ) = 2

           

           

          But I think you will see some refresh issues (as you probably already do with your current formula).

          Have you considered rotating your point of view by 90 degrees?

          • 2. Re: Self function on repeating field
            ptt555

            Comment,   That did it!

            I've come so far in the last few weeks with filemaker commands and syntax, but that's a great lesson that'll be useful in the future.

             

            A refresh is required, but it's a view/print only layout where the user is required to input a start date.  The script that runs upon that input takes care of that.   Rotating my point of view sounds rather painful at this late hour... I'll sleep on it and ponder the benefits in the morning.

             

            In a somewhat similar vein, is there a way to designate field names with variables in a script?

            Can the following be shortened?

             

            If [ $day = "d1" ] 

            Set Field [ graphicbook::d1; graphicbook::d1 + $count ] 

            Set Field [ graphicbook::d1[2]; $clientabbr ]

            Set Field [ graphicbook::d1[3]; $book_id ] 

            If [ $day = "d2" ] 

            Set Field [ graphicbook::d2; graphicbook::d2 + $count ] 

            Set Field [ graphicbook::d2[2]; $clientabbr ]

            Set Field [ graphicbook::d2[3]; $book_id ] 

            Etc, Etc, Etc

             

            • 3. Re: Self function on repeating field
              comment_1

               


              ptt555 wrote:

              Can the following be shortened?


              Probably, by (a) using Sst Field by Name to determine the field and (b) by looping through the repetitions.
              However, I see yet another hint here that your field/repetition to row/column correlation is off.

              BTW, why not make the repeating fields calculations? That's where the real power of repeating fields is.