[FX.php List] getting RecID after creating a record

Andy Gaunt andy at fmpug.com
Mon Nov 20 13:18:07 MST 2006


Alex,

 

You can also use;

 

list( $recid, $modid ) = explode( '.', key( $queryResult['data'] ) );

 

This will return the recid and the modid for a single record.

 

See http://www.fmpug.com/websnippets.php for this and other useful snippets
of code.

 

Andy Gaunt

Office: 321.206.3658

Mobile: 407.810.4722

andy at fmpug.com

http://www.fmpug.com    

 

2006 FileMaker Excellence Award Winner

Recipient of FileMaker's 2005 "Mad Dog" Public Relations Award

 

For chapter locations, dates & times please visit the website at
http://www.fmpug.com If you can make it to a meeting, please RSVP at
http://www.fmpug.com/rsvp.php

 

  _____  

From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Alex Gates
Sent: Monday, November 20, 2006 2:56 PM
To: 'FX.php Discussion List'
Subject: RE: [FX.php List] getting RecID after creating a record

 

Thanks, Bob!

 

I was able to get this with the second method - using the foreach from my
createResult.  This is very helpful. thank you!

 

Alex P. Gates
 

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Bob Patin
Sent: Monday, November 20, 2006 1:41 PM
To: FX.php Discussion List
Subject: Re: [FX.php List] getting RecID after creating a record

 

Alex,

 

Here's how I do it, although there's another method which I'll explain
below:

 

I create a Calc field called 'recid'; it equals "get(recordid).

 

Then, after you create a new record, just do this

 

$recid = $query['recid'][0];

 

You can also use the EXPLODE command, like this:

 

foreach($searchResult['data'] as $key=>$searchData){

            $recordDetails=explode('.',$key);

            $recid=$recordDetails[0];

 

Personally, I find the first method easier, but that's just me... I use it
all the time when I'm creating tables of found results, etc.

 

Bob Patin

Longterm Solutions

bob at longtermsolutions.com

615-333-6858

http://www.longtermsolutions.com

 

  CONTACT US VIA INSTANT MESSAGING:

     AIM or iChat: longterm1954

     Yahoo: longterm_solutions

     MSN: tech at longtermsolutions.com

     ICQ: 159333060

 

 

 

On Nov 20, 2006, at 1:20 PM, Alex Gates wrote:





Hi everyone-

 

I know this has been covered before, but I can't seem to find it.

 

I know it is possible to explode the array on a find to get the record

ID, but is it possible to get the RecID after a new record creation

without having to do a separate find?

If so, could someone please provide me with an example of the syntax?

 

Alex P. Gates

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20061120/ecacb9bf/attachment-0001.html


More information about the FX.php_List mailing list