1 of 1 people found this helpful
Are you using a global field on the"left" side of the relationshiop to filter out just the live projects? If so this won't work in PHP due to the differences in how global fields work vs FileMaker Pro sessions.
One thing to check.
FileMaker 12/11/10/9/8 Certified Developer
- - - - - - - - - - - - - - - - -
Phone: +61 2 9484 6565
Mobile: +61 418 468 103
You can, however, calculate those valuelistitems in a field that you can then do a foreach to get a valuelist... you don't actually have to use the function.
Obviously the easy thing to do is to make the global a standard field :-)
Yep - that could well be it. I'll have to think of another way of creating my live projects list.
Thanks very much for that prompt response, Anatole
If I know the number of records for the list will be relatively small I often just find the records by status etc then use that found set of records to generate the value list items.
1 of 1 people found this helpful
Hope this helps,
Thanks for your helpful comments.
I just created a new field in FileMaker that listed the live projects only. This I am using for the live projects ValueList rather than the related record filter. Problem solved.
It's always useful to discuss these issues as there are so many other options. But I also wanted to know if it was supposed to work - which it seems that it doesn't.
Thanks again for everyone's responses, Anatole
A conditional value list is harder in php because the primary choice can not be determined unless you post it.
Yes... that is why using the field values work as you post the global value and pick up the resulting values in the field in the same call.
I use this in my calendars to quickly switch days / weeks / months /years and even AM/PM. In a medical Appointment system I built I also overlayed Operations vs Consultations and Hospitals.
Glad you have this working...
As a test I took a value list that was supposed to show only values based on a relationship (which worked fine in a FileMaker client) and changed it to show all values. All of a sudden my code started working fine. Before it was returning an empty array.
It's interesting that the second parameter, Record ID, is not documented in the FileMaker PHP API manual (although it is used in one example).
It would be nice if they (A) documented the function and (B) described any limitations or circumstances under which it won't work.
For me going to a static value list is a real pain in the neck. And in future examples it may be impossible
$ValueList = $currentLayout->getValueListTwoFields($aValueList, $onerecord->getRecordId()); print_r($ValueList);
In PHP, there is not a "current record".
So you need specifying record id as what is the current record, to get related value list.
Is there something wrong with my code? I thought I specified the record ID as the second parameter.
And further to my posting, I tried this with a test database, again accessed via the PHP API. A master table with a child linked by the serial number of the master, with a value list containing all the values in one field in the portal. So, Master Record = "Flower", Child records = "Rose", "Violet", "Lily". Master Record 2 = "Animal", Child records = "Cat", "Dog". If the relationship is constrained to show just the portal values it does not work (getValueListTwoFields returns an empty array) but if it shows all records (Rose, Violet, Lily, Cat, Dog), it works fine.
No, your code may be correct (I can say only may be, since I didn't test it myself)
I tryed to do (B), when value list is "only related", there need base record.
Further, further to my posting, I'm developing a PHP function that takes, among other things, the 'name' of a value list that may be:
(A) the name of a FileMaker value list
(B) the name of a FileMaker field containing a list of values
(C) the name of a FileMaker field containing a list of (value + '|' + display text)
(D) a static list of values separated by "|"
The first 3 start with "@" just to distinguish them from the fourth. This allows me to have the benefits of FileMaker value lists that have a different value and display text while avoiding this nasty limitation of the FileMaker PHP interface. I can post the code when I finish debugging it if people are interested.
I'm having the same issue - using getValueListTwoFields to get a value list that uses related values. Works fine in FileMaker Pro but returning an empty array in PHP. I'm using an unstored calc field in the parent/left part of the relationship to filter out records with a status of 'active' - not using a global field here.
Is this supposed to work in this situation? I can't see any documentation that states otherwise. Changing it to show all values makes it work, but that's not the list of I want. I can do a find etc to generate the list manually but would like to use the native method where possible as it's less lines of code etc.
Anyone able to get the getValueListTwoFields method to work with the PHP API when the value list uses related values?