[FX.php List] modid, recid, and single record search results
Andrew Denman
adenman at tmea.org
Wed Dec 12 15:03:16 MST 2007
I use the following code to get at my data if I only have one record. When doing it the second way you can also get the recid and modid to work with.
list(,$data) = each($queryResult['data']);
-or-
list($key, $data) = each($queryResult['data']);
$recid = strtok($key, ".");
$modid = strtok(".");
To answer the other part of the original email, recid and modid are internal FileMaker IDs created to track records and changes made to a record; you usually never deal with them in a FileMaker-only solution, though you can access the record id in FileMaker with the Get(RecordID) function.
The record id (recid) for a record never changes once it is created and can be used to identify the record through FX.php (and in fact is needed if you will be editing or deleting the record). The modified(?) id (modid) is incremented each time the record is changed and can be used to determine if changes were made since the last time you accessed the data.
Andrew Denman
-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of DC
Sent: Wednesday, December 12, 2007 3:24 PM
To: FX.php Discussion List
Subject: Re: [FX.php List] modid, recid, and single record search results
note, this code provided by ggt below only gets you the $recid and the
$modid while the original question was about getting the record data
itself.
while you could use this technique to subsequently get the data in the
next line, it is much more direct to just use current() ( or each() ) to
get a single array *value* from the FX array's 'data' element without
knowing the explicit key and without using a foreach().
dan
Gjermund Gusland Thorsen had written:
> This is the way I plan on putting in the FX.php addendum I work on at the moment
> ---
> list( $recid, $modid ) = explode( '.', key( $queryResult['data'] ) );
> ---
> ggt
>
> 2007/12/12, Dale Bengston <dbengston at preservationstudio.com>:
>> Hi Jamie,
>>
>> If you have one record (and you can find out by looking at foundCount, you
>> can get past "knowing" the recid and the modid with something like this:
>>
>> if ($returnedData['foundCount'] == 1)
>> {
>> $theRec = current($returnedData['data']);
>> }
>>
>> For more on the use of current() on arrays, take a look at
>>
>> http://us2.php.net/manual/en/function.current.php
>>
>> Hope this helps,
>> Dale
>>
>>
>>
>> On Dec 12, 2007, at 12:45 PM, Jamie Adams wrote:
>>
>>
>> Hello all,
>>
>> I have a script that pulls data on individual records. It does a search for
>> the records primary key value in the primary key field. And with any luck,
>> finds one and only one record. So my FMFind() returns an array with all the
>> usual stuff, and my single, solitary record, to my $ReturnedData array. So
>> I should be able to get my data in ReturnedData['data'], but I have to
>> specify and record ID and a mod ID. I assume since there's only one record
>> in my found set, my RecID is either 0 or 1. But what's my ModID? I'm not
>> making any changes, so I just want the most current version.
>>
>> When I have multiple records returned, I do a foreach($ReturnedData['data']
>> as $key=>$searchData), and then use $searchData as my array of search
>> results. That works, but I never really understood why. And it seems
>> wasteful and inefficient to use the foreach() when I only have 1 record. Is
>> there another way?
>>
>> Jamie Adams
>> ________________________________________________________
>>
>> Liquis, Inc.
>>
>> 400 Parker Drive, Suite 1110, Austin, TX 78728
>> phone 512.299.9634, ext 103 -- fax 512.873.0575
>> ________________________________________________________
>>
>> www.liquis.com
>> www.auctionpartner.com
>> www.furniture-partner.com
>> eBay Store:
>> http://stores.ebay.com/Auction-Partner-High-Tech-Equipment?refid=store_______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list