Jump to content

This topic is 7483 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I have a just quick question.

Is there a easy way to get the last record id entered.

I know the way to go it in mysql but not with filemaker and FX.php.

any help appreciated

Posted

Do you mean the RecID of the last record you "just created" or the last record in the file ? I am asking because if you are in a multi-users scenario, these could be quite different.

If it's the record "just created", you can obtain the recID from the results of the FMNew call as such:

FMNew ($returnDataSet = true, $returnData = 'full')

Creates a new record in FileMaker pro with fields populated with the values specified by instances

of the AddDBParam() function. By default, data is returned -- the record just created.

// Not a complete query, FX() and SetDBData() are missing...

$InstanceName->AddDBParam('FirstName', $firstName);

$InstanceName->AddDBParam('LastName', $lastName);

$InstanceName->AddDBParam('Office', 'Austin, TX');

// ... that being done, you should be able to retrieve the RecID of

// the record JUST CREATED.

$ReturnedData = $InstanceName->FMNew(); // stores the new record in $ReturnedData

$recKey = key($ReturnedData['data']);

$recordPointers = explode (".",$recKey); // where $key is the current key from $ReturnedData['data']

$recID = $recordPointers[0]; // here's the RecordID

$modID = $recordPointers[1]; // and here's the ModifyID

This topic is 7483 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.