February 2, 200520 yr 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?
February 3, 200520 yr 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.
February 3, 200520 yr 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.
February 3, 200520 yr Author These both sound like great suggestions. I'm going to try them right away. Thanks for giving me hope!
February 4, 200520 yr 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.
February 4, 200520 yr 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?
February 4, 200520 yr 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