Jump to content

Nested case() or some other method?

This topic is 4426 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I work in printing and I'm trying to set up a calculation that will provide the maximum number of pages that can be fit on a given press sheet size. The math behind this is easy and it's also very easy to do it in one's head, but I'm a novice at formatting filemaker functions, so I'm getting lost in nested case functions.

The are a limited number of press sheet sizes that we use in printing, but the method of calculating this fit is a simple test which I'll word out (all values are in inches):

For example: If the press sheet size = 25 x 19 and the page size is 8.5 x 11, then:

(Int (25 / 11 = 2.272) * Int (19 / 8.5 = 2.235)) = 4

(Int (25 / 8.5 = 2.941) * Int (19 / 11 = 1.727)) = 2

The larger of the two values is the proper fit, so in this case we can fit four 8.5 x 11 pages on a 25 x 19 press sheet. It's actually a simplified test as there are more parameters involved, but this is the gist of it.

Then field NoUpPerSheet holds the calculation and is dependent on the user inputting values such as 8.5 into PageSizeW and 11 into PageSizeH. I'm trying to set up a let function with only 2 press sheet sizes so far, but my problem is with the calculation. I want to have it test all press sheet sizes given any page size. Seems like this calculation could not only tell me the maximum number of pages than can fit on any press sheet size, but also tell me the smallest press sheet size if we can't fit more on any larger press sheet sizes. For example, both 25 x 19 and 26 x 20 can only fit four 8.5 x 11 pages, so we'll use 25 x 19.

Let ( [

ss2a = Int (25 / PageSizeH) * Int (19 / PageSizeW) ;

ss2b = Int (25 / PageSizeW) * Int (19 / PageSizeH) ;

ss3a = Int (26 / PageSizeH) * Int (20 / PageSizeW) ;

ss3b = Int (26 / PageSizeW) * Int (20 / PageSizeH) ] ;

Case (

Case ( ss2a >= ss2b ; ss2a ; ss2a < ss2b ; ss2b ) >=

Case ( ss3a >= ss3b ; ss3a ; ss3a < ss3b ; ss3b )

; NoUpPerSheet

) // End Case

) // End Let

Or perhaps this would be better to set up as a script rather than one calculation?

Link to comment
Share on other sites

I did make a related table for them. There are about 20 sizes in a table with the fields SheetSizeW and SheetSizeH. But it seemed easier to me to make a calculation because I haven't yet figured out how to call these records, run tests and then output the results into the parent table fields NoUpPerSheet and SheetSizeName. I figure I would need to set up a script for this.

Link to comment
Share on other sites

A lot of things become clearer when you see a solution to specific problems that one has in mind. This is very useful. Thank you.

I'm going to set up the tests on both dimensions using your model. That button looks like it will need a script to do that.

Link to comment
Share on other sites

This topic is 4426 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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

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