November 23, 201114 yr Newbies Hi Guys, I have only started working with FileMaker for the last 2 months or so, and I didn't like the way that the API is very procedural driven, so I decided to make a class which would help me. I have got a function which I have made which interacts with the FM PHP API (Official) which I am trying to get sorted. The idea to the whole class is to save time writing each function over and over again, but basically I have got this function which I am having problems with which is to get the FileMaker Layout Fields and Values of those fields and put them into an array. Here is my code: /** * Selects data from a FileMaker Layout from the given criteria * * @author RichardC * @since 1.0 * * @version 1.2 * * @param string $layout * @param array $arrSearchCriteria * * @return array */ public function select( $layout, $arrSearchCriteria ) { $arrOut = array( ); if ( ( !is_array( $arrSearchCriteria ) ) ) { return false; } $findReq = $this->fm->newFindCommand( $layout ); foreach ( $arrSearchCriteria as $field => $value ) { $findReq->addFindCriterion( $field, $value ); } $results = $findReq->execute(); // Adds all the fields in the layout to the array $this->fields[] = $results->getFields(); if ( $this->isError( $results ) === 0 ) { $records = $results->getRecords(); //Set the last used layout and object $this->layout = $layout; $this->lastObj = $records; //Loops through the records retrieved foreach ( $records as $record ) { $arrOut[] = $record; //Here I want to Get the Layout FieldNames and Values into an array -> example : $arrOut['user'] = 'DarkMantis' } } else { $arrOut['errorCode'] = $this->isError( $results ); } return $arrOut; } As you can see there, I have commented in that I want to get the Details into my array. If you have any ideas on how to do this it will be greatly appreciated. [Edit] I do apologise for the messy code, it was more of a PoC. [/Edit] Best Regards, DarkMantis
December 7, 201114 yr You might want to look at how FX.php does this... the FileMaker XML interface exposes this...
Create an account or sign in to comment