[FX.php List] Current function

Joel Shapiro jsfmp at earthlink.net
Thu Nov 13 12:34:44 MST 2008

Hi Anders

Here's my understanding:

If you wanted to use the current() function, you could use:

current( $recordDetails )  *instead of*  $recordDetails[0]

but that doesn't really save you anything, and either way, you still  
need to use explode() to capture the recid...

If you ever display the returned 'data' array in FX.php ($createResult 
['data']), you'll see that it looks like:

     [41.6] => Array
             [NameFirst] => Array
                     [0] => Anders
             [NameLast] => Array
                     [0] => Monsen

You'll notice that the first (and only) element of this array has a  
key of "41.6".  That represents FileMaker's internal Record ID and  
Modification ID (i.e. the number of times that record has been  
modified), so in my example, your record has recid 41 and has been  
modified 6 times.

In your foreach loop example (below), the explode() function is used  
to separate the values on either side of the period into separate  
values of a new $recordDetails array:

     [0] => 41
     [1] => 6

Then to get the record id, you can use either current() or [0].

NOTE: I'm not sure how list() is preferable to creating an array.   
GGT or Steve care to comment?


On Nov 13, 2008, at 9:26 AM, Anders Monsen wrote:

> Revisiting this function, is it possible to get the FileMaker  
> record ID via current( )? I use this to pull fields from a found  
> set of one, and I need to send over the recid in a form.
> Until now I have been using something like this:
> foreach($createResult['data'] as $key=>$value) {
> 	$recordDetails = explode('.',$key);
> 	$currentRecord = $recordDetails[0];
> }
> While I like the elegance of current( ), I am not sure how to  
> isolate the recid piece, which would be very useful.
> Thanks,
> Anders

More information about the FX.php_List mailing list