Pbeyrouty Posted March 25, 2010 Posted March 25, 2010 Does anyone know an easy way to determine what page a record is on when in preview mode? I need to determine what records are showing up on the last page of a print out. I can't simply go to the last record and cycle backwards because in preview the command only changes the page. My issue is this, I need to know which records are on the last page so I can create a calc field to force the Trailing Summary to the bottom of the page (as opposed to appearing right after the last record). I cannot simply count the number of records and figure out what records will appear on the last page because the records are displaying one line that is the name of the stock item, and another field below it that is the description. The description length varies depending on the item. The issue is further complicated by the fact that the description field does not cut across pages. If the description will not fit on the current page, the whole record is moved over to a new page, leaving extra room on the last page. I don't mind the extra room but it complicates counting the number of lines in the description in order to determine where the last records are. If anyone has any ideas they would be greatly appreciated. I really don't want to try to calculate which records will get moved to a new page and thus how many lines to add.
lawaid Posted March 25, 2010 Posted March 25, 2010 Hey, a few thoughts come to mind. I can't simply go to the last record and cycle backwards because in preview the command only changes the page. True, but the script step "Go to Record/Request/Page" does function in Preview Mode, and you can specify the step to go to the Last Page. Next step, set a Global field or a Script Variable (if you're familiar with them) using the "Get ( PageNumber )" function. You now know the Last Page. My issue is this, I need to know which records are on the last page ... If your record set is Sorted, you can know the last record, and with the scripting described above, you can determine the Last Page. ... so I can create a calc field to force the Trailing Summary to the bottom of the page (as opposed to appearing right after the last record). And here's where you might consider alternatives. I presume it's hard to locate your report's Totals when they're printed half-way up the last page. Have you considered making it a Leading Summary, so your Totals would appear on the first page? Another approach ... thru scripting you could obtain the report's totals, populate global fields with that data, and place these global fields in your Footer or Header. Just some ideas. Hope it helps!
Pbeyrouty Posted March 25, 2010 Author Posted March 25, 2010 Thanks for the feedback but none of this really helps me. Finding the total number of pages isn't the problem. What I need is a way to determine the records that located on the last page using a script. If I use the goto last page command it will visually show the last page, but I cannot figure how to determine what records are located there (not just the last record, all of the records on the last page). If I exit preview mode and goto the second to last record then reenter preview mode it takes me to the first page. As a result any calc fields that display the page number will say it is the first page. Even when it is the second to last record that is selected. I can't put the totals in ahead of the rest because the client does not want it that way. If put them in the footer they will appear on every page. I could use conditional formating to have them only show on the last page, but then that space on the page will be unused on the other pages. This is going to be something that is printed out and needs to look professional.
lawaid Posted March 25, 2010 Posted March 25, 2010 Okay, how about creating an Unstored Calculation if "Get ( RecordNumber ) = Get ( FoundCount )" then yourResult. Place this field in the Body of your layout. Apply desired Sliding options. The calc should resolve only for the last record in the found set. Would that do it?
Pbeyrouty Posted March 25, 2010 Author Posted March 25, 2010 Again, I don't need the last record. I need all of the records on the last page. Its really annoying that filemaker can't make the trailing summary go to the bottom of the page. You'd think that would be an easy thing to setup.
comment Posted March 25, 2010 Posted March 25, 2010 If I had to do this (and I would try very hard not to), I'd probably do it this way: Check the total number of pages. Add lines between the last record and the trailing grand summary until the number of pages increases by one - then go back one step. The process could be optimized by taking large steps at first and reducing them gradually, e.g. add 64 lines until the page count increases, then subtract 32 etc.
Recommended Posts
This topic is 5355 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 accountSign in
Already have an account? Sign in here.
Sign In Now