Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Retrieve Lone Record With Random Record ID

Featured Replies

  • Newbies

Hello,

We have a FileMaker Solution and are using the FileMaker PHP API to produce a custom site. Certain fields, like a module's name i.e. "Contacts" have their labels stored in a record that gets generated as they log in. So the record ID is seemingly random. The only way to retrieve a record's data, as far as I can tell, is to use:

$record = $fm->getRecordById('LayoutName',recordID).

I see there is a method newFindAnyCommand('LayoutName'), which might work except this does not return a FileMaker_Record, but instead a FileMaker_FindAny class. I hope I'm being clear enough, still getting used to the FM API here. Thanks for your time!

If it gets generated at login, it should be the last record in the database at that point... so doing the findall with a sort on the recordid (highest to lowest) should work I think

If it get's generated as they login then you should have access to the FileMaker Result object which will contain a list of records that were returned - in this case 1 single record that you just created. On a side note I'm reasonably sure that you can't sort on record id though i'm not sure why you'd want to.


$add = $fm->newAddCommand('layout');

$add->setField('someField',$someValue);

$result = $add->execute();



if( !FileMaker::isError($result) ){

$record = $result->getFirstRecord();

$recordId = $record->getRecordId();



/*You could store the id of the record in the user's session here as well if you wanted for later use.*/

}

Edited by Guest

  • Author
  • Newbies

Thanks to both of you, and I'll be sure to try that out Genx

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.