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

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

Recommended Posts

  • Newbies
Posted

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

  • 2 weeks later...

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