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

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

Recommended Posts

  • Newbies
Posted (edited)

So the issue seems to be that I'm trying to sort on a field which is unstored. its pulled from another field if a value exists. its defintely pulling correctly as I can display the sort field in the search results.

heres the code that doesn't want to work:

$findCommand = $fm3->newFindCommand('Exhibitor Search');

$findCommand->addSortRule('ExhibitorSearchSort',1,FILEMAKER_SORT_ASCEND);

$result = $findCommand->execute();

So now I'm confused about what exactly filemaker has returned to me as $result. it is a multidimensional array? a resultset? can i use a standard php sort on this? somehow specifing the name of the field to sort by?

any help is appreciated and if i work it by some miracle i'll post so its here for someone else.

Edited by Guest
  • 2 weeks later...
Posted

Result is a result object or an error object depending on how your query went - you should take a look at the documentation.


<?php



$findCommand = $fm3->newFindCommand('Exhibitor Search');

$findCommand->addSortRule('ExhibitorSearchSort' ,1,FILEMAKER_SORT_ASCEND);

$result = $findCommand->execute();



/*After the find, check if it's an error. If it is, die with the message... obviously don't do this if this is a production environment*/

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

	echo $result->getCode().": ".$result->getMessage();

	die();

}



/* Retrieve array of record objects from the result object. These are already sorted by your ExhibitorSearchSort field */

$records = $result->getRecords();



/* Loop through the record object and manipulate using the commands you have available... Again look at the documentation. Most likely, you're after field values. */

foreach($records as $record){

	echo $record->getField("Name of Some field on the exhibitor search layout")."
";

}

Hope that's of some help - this is the quickest way to find the methods available and the return types for each fm function call: http://jonathanstark.com/filemaker_api_for_php_documentation.php

  • Like 1

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