3 Replies Latest reply on May 15, 2009 5:21 PM by b3nelson

# A Calculation

### Title

A Calculation

### Post

I'm not a mathematician, nor a filemaker genius, but I do need to figure out how to do this equation...

We produce labels, we need to center the labels on a sheet. Page sizes vary from 8.5x11, 8.5x14, 11x14, 12x18

Variables are:

height and width of each label, gaps between each label, and number of labels down and across.

I need to produce the end result with a left margin and a top margin in fractions of 32nds (rounded up or down so that 12.4/32 is 12/32 and 12.5/32 is 13/32) and an error message if top margin less than .5  and left margin is 0.1875

Fields I am using with explanation -

"Size AC" - Label Width

"Size AR" - Label Height

"Qty AC" - Label Quantity Across

"Qty AR" - Label Quantity Down

"Gaps AC" - Gaps between labels across

"Gaps AR" - Gaps between labels down

"Total Lables" Calculated field (Qty AC x Qty AR)

"Left Margin" Where the calculated left margin goes, but still modifiable for specified margins

"Top Margin" Where the calculated top margin goes, but still modifiable for specified margins

"File Top Margin" - Copy Top Margin but in decimals not fractions

"File Left Margin" - Copy Left Margin but in decimals not fractions and subtract 0.137

File will be posted to brentnelsonmedia.com/filemaker if you want to look at what I am working with. Layout - "Design"

• ###### 1. Re: A Calculation

My guess for the formula is (not filemaker correct an any way, but in my mind works)

(Size AR) x (Qty AR) + (Qty AR) x (Gap AR) - (Gap AR)  = (Used Area AR)

(Size AC) x (Qty AC)+ (Qty AC) x (Gap AC) - (Gap AC) = (Used Area AC)

(Used Area AC) x (Used Area AR) = (Total Used Area)

Get (Sheet Size)

If (8.5x11); (Top Margin) = 11 - (Used Area AR) /2; (Left Margin) = 8.5 - (Used Area AC) /2;

If (8.5x14); (Top Margin) = 14 - (Used Area AR) /2; (Left Margin) = 8.5 - (Used Area AC) /2;

If (11x14); (Top Margin) = 14 - (Used Area AR) /2; (Left Margin) = 11 - (Used Area AC) /2;

If (12x18); (Top Margin) = 18 - (Used Area AR) /2; (Left Margin) = 12 - (Used Area AC) /2;

But this needs to auto calculate as the fieds are being entered, this is in my mind what a script should look like (not in FileMakers mind I'm sure)

• ###### 2. Re: A Calculation

I am not quite sure what is given and what needs to be calculated. I'd suggest you try to solve the problem in one dimension first. It seems quite clear that if users are allowed to input the label width, the horizontal gap between labels, and the number of columns, they can easily exceed the given page width - even before they have entered the optional left margin. So I think you need some kind of hierarchy that determines which values take precedence and which will be automatically adjusted to fit.

b3nelson wrote:
this needs to auto calculate as the fieds are being entered, this is in my mind what a script should look like

I don't think you need a script for this - and calculation fields will update "live".

• ###### 3. Re: A Calculation

No I dont think I need a script for this either, I'm sure a calculation will be just fine.

This is the calculation I  currently have to convert to 32nds, I found this searching around forums and I modified it abit to work in my situation.

Let([

integer=Int(Top Margin);

numerator=Mod(Top Margin;1)

];

Case(integer;integer &" ";"")&

Case(

Int(numerator*64) < 1;"";

Mod(Int(numerator*64);2) = 0; Div(Int(numerator*64);2) & "/32")

)

I guess all i need to know how to do is how to do simple multiplication and subtraction.