Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I'm familiar with FX and now I'm trying the PHP API. In FX, the result array from an ADD operation contains the data that was just added to the database. However, when I examine the result of an ADD operation using the PHP API, I don't find the record contents. Am I missing something? Is it really there? Maybe I have to Find the last record to get the contents.

Posted

The data is all there, but it is in an object not a standard data array. If you look at the api documentation for Result and Record objects, and the methods you can use on each, you should be able to get a better understanding of how it works.

Here is a little example of how you would get field data from a found set...


$result = $findCommand->execute();

$records = $result->getRecords();



// access data from all records

foreach( $records as $record ) {

    ECHO $record->getField('fieldName');

}



// access data from only the first record

$record = $records[0];

ECHO $record->getField('fieldName');

  • 1 month later...
Posted

To clarify a little further, when you execute the add command a FileMaker result object is returned containing the record that was just added. You access the record the same way you would if you were dealing with a result generated by a find command.


$result = $addCommand->execute();

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

 	$record = $result->getFirstRecord();

 	echo $record->getField("fieldName");

}

Posted

oops! he said 'add' didn't he? And off I went, rambling about looping through a found set.

he even wrote ADD in caps! :B

This topic is 5029 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.