Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Keeping Found Sets and Sort Orders

Featured Replies

I am relatively new to PHP and run into a couple problems I cannot figure out:

1.) The First, Previous, Next and Last buttons lose the sort of the first page. If a User performs a find, the list comes up sorted by name, but when they click the NEXT button for the next group, those records are unsorted. I can see the definition of the function that controls those links in fmview.php, but I don't know how to modify it. Here is the code:

function getStatusLinks($resultPage, $rs, $skip, $max) {

$links = array (

'first' => 'First',

'prev' => 'Prev',

'records' => array (

'rangestart' => 0,

'rangeend' => 0,

'foundcount' => 0

),

'next' => 'Next',

'last' => 'Last'

);

$fetchcount = $rs->getFetchCount();

$foundcount = $rs->getFoundSetCount();

$total = $rs->getTableRecordCount();

if ($total == 0 || $fetchcount == 0) {

return $links;

} else {

if ($fetchcount > 0) {

if ($skip > 0) {

$links['first'] = "" . $links['first'] . "";

if ($skip > $max) {

$prevskip = $skip - $max;

$links['prev'] = "" . $links['prev'] . "";

}

}

if ($foundcount - $skip > $max) {

$nextskip = $skip + $max;

$links['next'] = "" . $links['next'] . "";

$lastskip = $foundcount - $max;

$links['last'] = "" . $links['last'] . "";

}

$links['records']['rangestart'] = max($skip, 1);

$links['records']['rangeend'] = min($foundcount + $skip, $fetchcount + $skip);

$links['records']['foundcount'] = $foundcount;

}

}

return $links;

}

I did try to add a sortorder and sortfield to the links in fmview.php, but it worked for the found set, and then the subsequent finds no longer worked.

2.) Along similar lines, I would like next, previous, last, and first links to move from record to record in the browse record view.

Any help would be appreciated. Thanks!

Paging through result records is actually complex enough that the specifics of your situation can dictate the best approach.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.