Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Well my logic breaks on this one and I know it can be better also. LineItems holds Quantity (number) of 'eaches' sold. Products holds QtyPerCase (number) of how many are in a case. Joined on ProductID.

Packing Slip requirements: Currently we just display eaches (only the Quantity field). Owner wants it changed to display total 'cases' and 'eaches'. What I have (yep, ugly) ...

Let(

[

cs = Div(Qty; Products::QtyPerCase) ;

ea = Qty / Products::QtyPerCase - cs

]

;

Case(

ea > 0 ; cs & " Cases, " & ea & " Eaches";

cs = 1; cs & " Case";

not cs; ea & " Eaches";

cs & " Cases")

)

If Quantity is 1 and QtyPerCase is 12 it displays as: 0 Cases, .0833333 Eaches. Geez. Need to fix the eaches and I'd like to eliminate the cases portion if it's under a case also. I got myself a bit lost. Does it show? crazy.gif

LaRetta

Posted

Try:

Let ( [

cs = Div ( Quantity ; QtyPerCase ) ;

pc = Mod ( Quantity ; QtyPerCase )

] ;

Case ( cs ; cs & " Case" & Case ( cs - 1 ; "s" ) ) &

Case ( pc ; Case ( cs ; ", " ) & pc & " Piece" & Case ( pc - 1 ; "s" ) )

)

And pardon me for changing the vocabulary - I've never heard of "eaches".

If Quantity = 25, you'd get "2 Cases, 1 Each", which to me means "Let's you and I get some beer - 2 cases, one each".

Blackstuff.gif

Posted

I had tried using Mod() on the ... errr pieces portion. Oh! This means I'm *getting* it but just not quite *getting* it!! YAY!!! smile.gif

And I couldn't remember how you and JT and Ray split the (s) for single/plural in the Case() portion. Maybe I'll remember it now.

Yep, I had asked Owner about that wording ... biglaff.gif

It isn't 'bottles' because sometimes it could be tabs, etc. Eaches is all we could think of - pieces is perfect!

I will thank you in advance for the calculation, Michael. I have absolutely no doubt that it's perfect.

LaRetta

This topic is 7160 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.