January 1, 201115 yr 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.
January 1, 201115 yr 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');
February 16, 201114 yr 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"); }
February 17, 201114 yr 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
Create an account or sign in to comment