Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating an array in PHP from a Value List in Filemaker

Featured Replies

Hello!

Another post...

Please help me out.

I am trying to create an array from a value list within Filemaker Pro (Using PHP API)

The idea is to create an array of names from a value list I have set up... Then put them into an option tag.

e.g.

$staff = array(FileMaker Value List)
^^ I know that's incorrect, but it shows what I want to do

Then with that array I want to be able to Create a HTML option list (I know how I would do that)  ---  I am just really struggling with creating the array...

Here is what I have

 

$database = "comms__web";
    $hostname = "###.###.#.#";
    $username = "web";
    $password = "################";
    
    $layoutname = "Web";
    $valueListName = "MIS";
        //CREATE FILEMAKER OBJECT

        $fm = new FileMaker($database, $hostname, $username, $password);

    //GET THE LAYOUT AS AN OBJECT.

    $layoutObject = $fm->getLayout($layoutName);
 

    //GET THE VALUE LIST

    $valueList = $layoutObject->getValueList($valueListName);

 

However it doesn't actually appear to pick up the list...

Please help me out :) 

Thanks,

Edited by Jack Wright

You could inspect what is returned on the layout with print_r($layoutObject) and see what is in there. The value list must be associated with the field on that particular layout.

And what version of FMS are you working with? I believe that function may also be deprecated. Have you tried getValueListTwoFields instead?

  • Author
25 minutes ago, Mike Duncan said:

You could inspect what is returned on the layout with print_r($layoutObject) and see what is in there. The value list must be associated with the field on that particular layout.

And what version of FMS are you working with? I believe that function may also be deprecated. Have you tried getValueListTwoFields instead?

I am using FMS 14

Additionally 

The layout has a field on it with the valuelist assigned to it.

Nothing showed up with the print_r 
 

Seems like you are missing the FIELD object:

//CREATE FILEMAKER OBJECT
$fm = new FileMaker($database, $hostname, $username, $password);

//GET THE LAYOUT AS AN OBJECT.
$layoutObject = $fm->getLayout($layoutName);

$fieldName = "your_field_name';

//GET THE FIELD FROM LAYOUT AS AN OBJECT
$fieldObject = $layoutObject->getField($fieldName);

//GET THE VALUE LIST ATTACHED TO THIS FIELD
$valueList = $fieldObject->getValueList();

// FOR TESTING
echo "<pre>";
print_r($valueList);
echo "</pre>";

Good luck!
  • Author
On 7/13/2016 at 4:54 PM, dwdata said:

Seems like you are missing the FIELD object:

//CREATE FILEMAKER OBJECT
$fm = new FileMaker($database, $hostname, $username, $password);

//GET THE LAYOUT AS AN OBJECT.
$layoutObject = $fm->getLayout($layoutName);

$fieldName = "your_field_name';

//GET THE FIELD FROM LAYOUT AS AN OBJECT
$fieldObject = $layoutObject->getField($fieldName);

//GET THE VALUE LIST ATTACHED TO THIS FIELD
$valueList = $fieldObject->getValueList();

// FOR TESTING
echo "<pre>";
print_r($valueList);
echo "</pre>";

Good luck!

Thank You!

Will try this out when I am next on the computer!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.