AnsweredAssumed Answered

How do I use getValueList in PHP?

Question asked by WhitFarnum on Sep 22, 2011
Latest reply on Apr 28, 2015 by samuelhaggai

Title

How do I use getValueList in PHP?

Post

    I am having difficulty getting value lists to display on my website using the getValueList function. I have followed the formats I found in various forums and blogs. I can get the arrays that are intermediates in the calculation to prints but I cannot get the final results. I have tried two different methods listed below neither giving success.
    I have also tried to get value lists generated from field summaries and from customized lists. Neither works. What am I missing? The code follows below. I read in a forum that the get getValueList broke in Filemaker 10 and was replaced by getValueListTwoFields. I tried this and it was no better. I am currently using Filemaker 11. Thanks.

Method looking up a stored list.
<?php
 require_once 'fmview.php';
    require_once 'FileMaker.php';
    require_once 'error.php';

    $cgi = new CGI();
    $cgi->storeFile();
    
    $databaseName = 'Species';
    $layoutName = 'web';

   $fm = & new FileMaker();
    $fm->setProperty('database', $databaseName);
    $fm->setProperty('username', 'pass');
    $fm->setProperty('password', 'pass');
    
    ExitOnError($fm);
    $layoutObject = $fm->getLayout($layoutName);
    ExitOnError($layoutObject);
    
    $valueList = $layoutObject->getValueList('Genus');
    ?>

The other approach uses
    $fieldObject = $layoutObject -> getField('Genus');
    $valueList = $fieldObject -> getValueList();

In the HTML section I then run
<?php print_r($valueList);
    echo 'message'; ?>

Only 'message' is loaded on the screen when the page loads.

Outcomes