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

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

Recommended Posts

  • Newbies
Posted

FX had convenient Next and Previous links that arranged all name value pairs and could be invoked by:

<?php echo $SearchResult['linkPrevious'];?>">PREVIOUS

<?php echo $SearchResult['linkNext'];?>">Next

Does the FM API have an equivalent?

Posted

Not really but it would be easy enough to grab. The Filemaker_Result object returns the records in a zero based numerically indexed array so all you have to do is use




/*where $FMResult is your Filemaker_Result object*/

$last = $FMResult->getFetchCount() - 1;

$FMRecords = $FMResult->getRecords();

foreach ($FMRecords as $key => $rec){

  /* $key will be set to the array key 

  so $key - 1 is the previous record in the array 

 and $key + 1 is the next record in the array

 don't forget check that you don't go off either end of the array */

$prev = $key > 0?$key - 1:0; 

$next = $key < $last?$key + 1:$last; 

 /* $rec will be set to the Filemaker_Record object.

$FMRecords['$prev'] will grab the previous record object

$FMRecords['$next'] will grab the next record object */

}

?>

you could session the $FMResult object and grab it when the page refreshes. This would have the advantage of reducing calls to the db thereby speeding up load times but you wouldn't get new data until you closed your session (i.e. completely quit your browser). If you choose to reload the $FMResult from the db on each refresh you'll need to make sure to pass a unique ID and loop through all records in your found set until you see it.

I'd advocate a third path of not sessioning the Object, and using AJAX and JSON to build, display, and scroll through your single record "Form" without refreshing the web page. It's getting into more "advanced" web programming, but with a little practice it's not that hard to pick up.

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