Jump to content
Jack Wright

Creating an array in PHP from a Value List in Filemaker

Recommended Posts

Jack Wright    0

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

Share this post


Link to post
Share on other sites
Mike Duncan    14

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?

Share this post


Link to post
Share on other sites
Jack Wright    0
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 
 

Share this post


Link to post
Share on other sites
dwdata    16
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!

Share this post


Link to post
Share on other sites
Jack Wright    0
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • By Anthony Girdler
      Hi,
      My programmer and I are trying to set up communication between FileMaker 16 and a WordPress website(www.heightspethospital.com.au ) so our veterinary clients can do online booking and look up when their pets are due for vaccination and other treatments.
      My programmer has hit a problem.
      The code does not work on the WordPress Server (www.heightspethospital.com.au), though it works on his local machine.
      He gets the following error:
      “Communication Error: (7) Failed to connect to 203.206.217.177 port 8080: Connection timed out”
       
      Filemaker error codes suggest this is a memory issue, but my programmer is sure it's not related to memory.
      He has tried re-installing filemaker server multiple times with no effect. I think he said the default port is 80, but that cannot be used for an unknown reason and he has chosen to use port 8080.
       
      The filemaker database is stored on:
      PC Windows 10 home 64-bit
      Filemaker server 16
      Processor: Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz (12 CPUs), ~3.3GHz
      Memory: 16384MB RAM
       
      Wordpress 4.8.1 hosted by SiteGround.
       
      Any answers or leads greatly appreciated.
      Anthony.
      PS. I don't know anything about programming and computer jargon, so I apologise if I have some of these terms wrong.
    • By Richard Carlton
       
      PHP VIDEO 2 - Process Walkthrough: https://youtu.be/yAQX0B9Hfyk
      PHP VIDEO 3 - Sample Code Review: https://youtu.be/9thUCa_q_eY
      Download Sample Code: http://fmstartingpoint.com/links/dl_proc.php?idc=CPN_S0067
      Live PHP Page to try out: http://fmstartingpoint.com/links/dl_proc.php?idc=CPN_R0068
      FileMaker CWP Guide: https://fmhelp.filemaker.com/docs/16/en/fms16_cwp_guide.pdf
    • By sal88
      Hi all
      I've created a value list that serves as an email autocomplete drop down (like the sort in an email client). This VL looks to a single text field in a single record table which currently has 3000 lines. The field is updated every 15 minutes by a scheduled server script.
      The 'auto complete using value list' option is applied on the field that refers to this VL.
      The old method was to not have a VL but to just tick the 'auto complete using existing values' option on the field. This was not ideal because existing values might be incorrectly spelled email addresses (and the user would not be able to remove them).
      Since switching to the new method it is slower to retrieve the values from the VL. It is not the type of slowness that locks up filemake; rather it just means the user has to wait 1-4 seconds for values to pop up when letters are typed - before this is was instant in the way it is instant in normal email clients.
      Does anyone have any ideas as to how to speed it up? Or whether this is expected from a single field VL?
       
      Thanks
    • By Joel Shapiro
      Don't forget!
      Monday July 24, 3:30–5:30 (before the 6pm opening keynote).
      Come see:
      Steve Winter @steveWinterNZ
      Mark DeNyse @mdenyse
      Ken d’Oronzio @kdoronzio
      Gjermund Thorsen ggt667
      Joel Shapiro @jsfmp
      Hope to see you there!
      -Joel
      http://jsfmp.com/cwp-user-group
       
    • By jamescv7
      XML error: No memory at line 1
      Greetings, this error occurred when the Filemaker API cannot generate a bunch of records. (1000+ records and above)
      I've adjusted the time out settings for PHP even the memory limits.
      Is there any possible solution for this?
       
      According to some information, the error turns out that the 10 MB XML scripts is unchangeable.
      thanks.
×

Important Information

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