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.

Please Help! iD 1st and last record on page

Featured Replies

Gang-

I'm creating a telephone directory and I need to duplicate the behavior found in many dictionaries or encyclopedias: I need to show in the header the first surname on the page and the last surname on the page. They must both be in the header and appear in the format "surnamefirst - surnamelast" where surnamefirst is the last name of the FIRST record on that page and surnamelast is the last name of the LAST record on that page.

I'm at a loss as to how to do this. If I just put the surname field in the header, it correctly displays the first surname from that page, but what must I do to somehow grab the last surname from a given page?

If you put the surname in the footer it will give you the last one on the page. You might try using a calculation first surname = surname and store as global. Put this field in header. Another calculation last surname = surname and store as global. Put this field in footer. Then use these for a third calculation = first surname & " - " & last surname and store as global. You can hide the first 2 calculations. and just show the third.

Haven't tried this, just the first thing that came to mind. Let us know how it works.

If the number of records per page is a constant, then it should be easy, except maybe the last page.

If not, then create a PageNumber field and populate it as described here.

Next, create a self-join based on PageNumber = PageNumber.

Sort the relationship in the opposite direction to your printing order.

Put "Surname" & "related::Surname" in the header.

  • Author

These both sound like great suggestions. I'm going to try them right away. Thanks for giving me hope!

Use comment's method, I tried my idea and it didn't work. I added a field for Page Number, Last Name On Page and a calculation = Last Name & " - " & Last Name On Page. I put this field in the header. This is not fast but it does work.

  • Author

Ralph, I tried your method, also, and saw that it didn't work. One thing that seems to be amiss in what I'm doing is even when I just put the surname field in the header and footer, I'm getting the first surname in the header, as I would expect, but I'm getting the first surname from the next page in the footer, which puzzles me. Is this a bug, something I'm doing wrong, or a misunderstanding on my part of how a field in a header versus in a footer behaves?

As for your suggested method, I'm not clear how you're using the page number field to somehow capture the last surname on the page. Can you elaborate?

This is how I modified the script referenced by comment.

Go to Layout [ "PhoneBook" (PhoneBook) ] /* Golbals */

Clear [ PhoneBook::gPage ] [ Select ]

Clear [ PhoneBook::gLastPage ] [ Select ]

Clear [ PhoneBook::gLast_Name_on_Page ] [ Select ]

Go to Layout [ "Page" (Giver_BR) ] /* Phone Book Page */

Show All Records

Loop

Enter Preview Mode

Go to Record/Request/Page [ Last ]

Set Field [ PhoneBook::gPage; Get ( PageNumber ) ]

If [ PhoneBook::gLastPage =? PhoneBook::gPage ] /* check for change in page number */

Set Field [ PhoneBook::gLastPage; PhoneBook::gPage ]

Set Field [ PhoneBook::gLast_Name_on_Page; Giver::Last_Name ]

End If

Enter Browse Mode

Go to Record/Request/Page [ Last ] /* Update this record */

Set Field [ Giver_BR::Page Number; PhoneBook::gLastPage ]

Set Field [ Giver_BR::Last Name on Page; PhoneBook::gLast_Name_on_Page ]

Omit Record

Exit Loop If [ not Get ( FoundCount ) ]

End Loop

Show All Records

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.