stanley Posted May 10, 2004 Posted May 10, 2004 Hi all: I've got this hideously difficult page-layout problem that I've been working with for quite a while now. The client has one layout for the first page, another for the last page, and a third for any pages that go in between. The body is a list of items, and I'm printing from the file with the data in it. What I've got happening now is that the user can enter preview mode & view a 1-page layout, or a 2-page layout, and see which one works. There is no option for a longer layout, because I can't figure out how to determine which record would go on which page. Each of the three layouts has a different amount of body space (due to different headers & footers), so my idea was to begin with the first layout & step through the records, using Status(CurrentPageNumber) to see which items belonged on the first page. Then I could set that group aside, do a new find (omitting the page 1 items) and begin stepping through the rest, to determine if they will fit on a LastPage layout, or if I've got to use a MiddlePage layout instead... but I'm not getting any data out of my Status call. Well, that's not exactly true. I'll get a single returned item somewhere in the middle of my group. Does anybody have a clear way of telling, in preview mode, what page you're on? I was also hoping to be able to just go to the last record & see what page I was on there, but I'm not getting that info either... Thanks, Stanley
Fitch Posted May 10, 2004 Posted May 10, 2004 If you just want to see the page number in Preview, insert a Page Number Symbol on the layout. If you want to use a Status function in a calculated field, you should always make it Unstored. If you want to use the number of pages in a script, you can do this: Enter Preview Go to record (last) Set Field( someGlobal, Status(CurrentPageNumber) ) Now you can use that global field in doing whatever the heck it is you're trying to do. Have you looked into using Title Headers and Footers?
stanley Posted May 10, 2004 Author Posted May 10, 2004 Tom: I wasn't being clear enough. What I really want to be able to see is what page each record is going to appear on, so that I can then determine which layout to use when printing... -Stanley
Vaughan Posted May 10, 2004 Posted May 10, 2004 Why not put the first page onto the Title Header and the last page on the Title Footer: get it back down to one layout.
Fitch Posted May 11, 2004 Posted May 11, 2004 As long as the body part doesn't slide up/reduce, it shouldn't be too hard. Determine how many records will fit on each of your layouts, then count the number of found records and do the math. No need to preview. E.g. if 5 records fit on first page, 8 fit on last page, and 10 fit on middle pages (what are the real numbers?) Print page one If ( Status (CurrentFoundCount) < 6 ) . Exit script Else . Omit 5 records End If If ( Status (CurrentFoundCount) < 9 ) . Print last page . Exit script End If etc.
RalphL Posted May 11, 2004 Posted May 11, 2004 The Title Header & Title Footer appear on the first page.
RalphL Posted May 11, 2004 Posted May 11, 2004 To add to this idea. Add a number field Page. In you print script loop thrugh the records to be included and assign a value to Page. Then sort by Page. Use leading sub-summaries with a page break to start each page. Use a trailing Grand Summary to finsih your last page.
Vaughan Posted May 11, 2004 Posted May 11, 2004 "The Title Header & Title Footer appear on the first page." Yes, you are correct. I should have said Leading Grand Summary and Trailing Grand Summary.
stanley Posted May 11, 2004 Author Posted May 11, 2004 Unfortunately, there is sliding involved - a record can be anything from 2 to 8 lines - so I can't do any simple arithmetic, and I'm still at a loss how to figure this one out... It's one of these cases where the client absolutely needs to keep the legacy paper format, due the printout being a format decreed by the US Federal Government. -Stanley
stanley Posted May 11, 2004 Author Posted May 11, 2004 Also, I'm printing a conditional footer (really part of the header), which should only print on the last page. For lenghts of one and two pages, this works. This is the real issue - how to determine which page this footer should appear on, and how to not have a footer appear on the middle pages, when I go over two pages... -Stanley
RalphL Posted May 11, 2004 Posted May 11, 2004 You might be able to do something like this: Use the Troi Text Plug-in to make a calculated text field of the body of your report. Using Left, Middle & Right functions to divide this into pages. Use a different layout for first, middle & last page. I have used a similiar approach in one of my database systems.
Fitch Posted May 11, 2004 Posted May 11, 2004 Maybe you could just use a brute force method, e.g.: 1. capture the record id's of the found set into a global field 2. use the middle() function to grab the first x number of id's into a second global field, where x = a few more than the max that will fit on two pages 3. gtrr (based on the x field) 4. preview, go to last page and grab the page number into a global 5. if the page count is > 2, use the middle() function to lop of the last id in the x field 6. repeat steps 3-5 until you get to 2 pages etc. When you're done, you can restore the original found set from step 1. It might be slow -- try freezing the window at the top of the script and it should run a little faster.
stanley Posted May 12, 2004 Author Posted May 12, 2004 Ralph & Fitch: Both interesting approaches. Thank you. I off-handedly mentioned to the client that everything would be just fine if only certain fine print didn't have to be at the very bottom of the last page (part of the government layout which is the whole problem) and he suddenly does an about-face and says, "heck, it doesn't really matter that much, print it wherever you want to." So three days of pulling my hair out are for naught. I'll try these things out anyway, though, just out of curiosity (and the suspicion that the about-face will at some time reverse itself.) Thanks again, guys. -Stanley
Fenton Posted May 12, 2004 Posted May 12, 2004 John Mark Osborne has some interesting techniques for letting you control printing. Take a look here: http://advisor.com/doc/11328
Recommended Posts
This topic is 7502 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