4 Replies Latest reply on Jun 10, 2014 7:19 AM by DomMolloy_1

    PHP API - repeating fields

    DomMolloy_1

      Title

      PHP API - repeating fields

      Your post

           how do you reference repeating fields returned in a record via the PHP API

        • 1. Re: PHP API - repeating fields
          databuzz

               Hi,

               You use the following syntax:

               $record->getField('firstName', 1);

               where 1 is the repetition number you wish to target.

          • 2. Re: PHP API - repeating fields
            DomMolloy_1

                  

                 Thanks Databuzz

                  

                 Now having a problem with writing/editing the repeating field. What is the best documentation source for these questions?

                 This does not work:

                  $FMEditCommand -> setField (('Grid_Location_Name', $x), "Test"); 

            • 3. Re: PHP API - repeating fields
              databuzz

                   Hi Dom,

                   The syntax for setting a field and specifying the repetition number is similar to retrieving the field value. This is from the PHP API documentation which you can find in your FileMaker Server folder. On my Mac it's found at:

                   /Library/FileMaker Server/Documentation/PHP API Documentation/index.html

                    

              setField (string $fieldstring $value, [integer $repetition = 0])
                     
              •           string $field: Name of the field to set.
              •      
              •           string $value: Value for the field.
              •      
              •           integer $repetition: Field repetition number to set, Defaults to the first repetition.

              For example:

              $record->setField('firstName', 'Andrew') , 2 ;

              where 2 is the repetition number you wish to target.

                   cheers,

                   Andrew

              • 4. Re: PHP API - repeating fields
                DomMolloy_1

                     Thanks Andrew -  appreciate the fast response.