3 Replies Latest reply on May 27, 2015 3:17 PM by databuzz

    getValueListTwoFields

    shwetam@metasyssoftware.com

      How to use "getValueListTwoFields" function to get the values from custom value list in FIleMaker on my web page?

      Previously We used getValuelist() function. But when we upgraded to the FMS 13, that function is not working properly (the page which has the functionality to display the data from valuelist not get executed.).

       

      So we used "getValueListTwoFields" function for displaying custom valuelist. Now that page is getting displayed. However, values are not getting populated from FileMaker Valuelist. We want proper syntax for this function for Custom Valuelist. What is the second parameter for that function if we want to fetch the custom valuelist.

        • 1. Re: getValueListTwoFields
          databuzz

          Have you had a look at the FileMaker Server 13 Custom Web Publishing with PHP PDF ?


          Here's an excerpt that should help explain how to use this (p35):

           

          For a specific layout object, use the getValueListTwoFields() method to get an array of choices defined for the named value list. The returned array is an associative array that contains the displayed values from the second field of the value list as the keys, and the associated stored values from the first field as the array values.

           

          Depending on the options selected in the Specify Fields for Value List dialog box in the FileMaker database, the getValueListTwoFields() method returns the value in the first field only, the value in the second field only, or the values in both fields of a value list as the stored and displayed values.

           

          * If Also display values from second field is not selected, the getValueListTwoFields() method returns the value from the first field of the value list as both the stored value and the displayed value.

          * If Also display values from second field and Show values only from second field are both selected, the getValueListTwoFields() method returns the value from the first field as the stored value, and the value from the second field as the displayed value.

          * If Also display values from second field is selected and Show values only from second field is not selected, the getValueListTwoFields() method returns the value from the first field as the stored value, and both values from the first and second fields as the displayed value.

           

          Use an iterator with the getValueListTwoFields() method to find the displayed value and stored value.

           

          Example

          $layout = $fm->getLayout('customers');

          $valuearray = $layout->getValueListTwoFields("region", 4); foreach ($valuearray as $displayValue => $value) {

          .... }

           

          ----

           

          The 2nd optional parameter is where you can pass a record ID to choose the record from which the value list should be displayed.

           

          HTH,

          Andrew

           

          Databuzz

          FileMaker Business Alliance

          FileMaker 13 Certified Developer

          Xero Approved Developer

          - - - - - - - - - - - - - - - - -

          Phone: +61 2 9484 6565

          Mobile: +61 418 468 103

          Email: andrew@databuzz.com.au

          http://www.databuzz.com.au

          • 2. Re: getValueListTwoFields
            shwetam@metasyssoftware.com

            Thanks for your reply.

             

            We used the following code in php page

            $layoutObject = $connection->getLayout('WebAccounts');
            $StatesVL = $layoutObject->getValueListsTwoFields('States');

             

            But it returns an empty array. If we print the count($StatesVL), then it shows 0. We used the FMS 14. There is any change in syntax of the above function?

            • 3. Re: getValueListTwoFields
              databuzz

              There's no change from v13 to v14 that I'm aware of.

               

              I typically do something like this:

               

              $layout = $fm->getLayout('webDemo');

              $states = $layout->getValueListTwoFields('state');

               

              Double check you have a field on the layout with the specified value list. You can also try printing to screen all the valueless on a specified layout, e.g.:

               

              $layout = $fm->getLayout('webDemo');

              $valueListNames = $layout->listValueLists();

              echo '<p><pre>'.print_r ($valueListNames).'</pre></p>';