Jump to content
Sign in to follow this  
gchron

Calculate the number of records a page can hold

Recommended Posts

Hello to everybody,

I would like to know the number of pages I am going to print at a layout. I need this number for other calculations.

A way I can accomplish that is with:

Ceiling ( Get ( FoundCount ) / 26 )

where 26 is the number of records a page can hold.

Is there a way to get this number dynamically. So this script to work at an other layout where there are 30 records per page??

Thanks in advance

Share this post


Link to post
Share on other sites

I would like to know the number of pages I am going to print at a layout.

You can't really trust the number of records because, if you have sliding/printing on it will change and your record set can change as well. But you CAN determine how many total pages will be produced from a specific layout with the selected number of records by performing the action first.

Go to Layout [ your specific layout ]

... perform a find for your record set

Sort [ as you wish ]

Enter Preview Mode

Go To Record/Request/Page [ last ]

Set Variable [ $pages ; Get ( PageNumber ) ]

... do whatever you need with this number of pages. If you need this in a different script, you can use global variable by preceeding with two $$ instead of one, then it will persist after your script ends.

LaRetta

Share this post


Link to post
Share on other sites

Even that is not actually an automatic way, I could write the number at a global field to use it in calculations.

Share this post


Link to post
Share on other sites

Then what do you mean by automatic way? The computer must tell you in SOME fashion. Nothing happens without it being programmed. That is like saying you just want the computer to 'know' something but you don't want to have to even tell it what or how to gather the information. A global requires creating a field - a variable doesn't require creating anything. What do you want? :idunno:

UPDATE: Maybe it would help if you explained why you need this information. I can't imagine what you are attempting. There may be other ways of accomplishing the same thing. This also doesn't take into account the printer settings, all which will effect the number of pages. I suppose you could create a table with layout name and #pages and pull the number of pages from there but you still need to originally calculate the results and it STILL could change if you have sliding on. It all seems so twisted.

Edited by Guest
Added update

Share this post


Link to post
Share on other sites

Well, at least in theory you could make your calculation do =

Ceiling ( Get ( FoundCount ) /

Case (

Get (LayoutName) = "This" ; 26 ;

Get (LayoutName) = "That" ; 30 ;

...

)

)

It wouldn't be good practice, though, because the formula would need to be updated every time a layout or its name were modified. And, as LaRetta pointed out, this would work ONLY for layouts that do not use sliding, have no sub-summary or grand summary parts, and so on.

Share this post


Link to post
Share on other sites

See if this Demo file is of any help. Link

Share this post


Link to post
Share on other sites

The reason for this is that I want to display in the header of the print form the total number of pages.

Also All the totals I want to be displayed only at the last page. So I could create fields that will print numbers only if the current page is equal to the last page. I was looking for a way that I can accomplish that automatically (meaning something like a get command in a calculation script). I can use other methods but I asked for something like that. I will use the other methods then :-)

Share this post


Link to post
Share on other sites

To put Page # of # Total Pages, just use LaRetta's technique and see the link that Lee posted to Database Pros.

To have totals only on the last page, use a Trailing Grand Summary Part with summary fields in it.

Share this post


Link to post
Share on other sites

All the totals I want to be displayed only at the last page. So I could create fields that will print numbers only if the current page is equal to the last page.

I am afraid it cannot work that way, because it's circular logic. Suppose the layout can print 20 records on each page, and that there are 40 records. A calculation of the required number of pages would return 2 - but the totals must be printed on page 3. Conversely, if there are 22 records, 2 of those will print on page 2 - so you would get your totals printed TWICE.

The truth is that Filemaker doesn't know anything about pages while in Browse mode. It paginates "on-the-fly" when switching into Preview mode or printing.

You COULD create calculation fields that will return values only if the record is the last record of the found set - but you can achieve the same result much more easily by using a trailing grand summary part.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    Steve Martino 
×

Important Information

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