Sunday, March 11, 2012

Displaying Remainders

I need to show the whole number and remainder each as wole numbers. I have been trying to use modulo on the advice from a friend, but I don't understand this function.

More of an exlpanition: I am working with inventory and shipping quantities. If a pallet consists of 9 cases, and I have an order for 20 cases, I need to display in a report 2 pallets and 2 cases. These numbers can be in the same column or different columns...at this point I just need to be able to display the numbers.

Is there any way to do this? Any help would be appreciated.

-Thanks

P.S.

I posted this in the general forums before I realized I was there...not sure how to move posts, so I double-posted....sorry.

Hello,

Try this:

=cStr(cInt(Fields!CasesOrdered.Value / Fields!CasesOnPallet.Value)) + " Pallets " + cStr(Fields!CasesOrdered.Value Mod Fields!CasesOnPallet.Value) + " Cases"

Hope this helps.

Jarret

|||

This is what I need. Thanks

On this solution, how do I force a round down on the "Pallet" number (18.66667 is showing as 19 but needs to show as 18)?

I tried this:

=cStr(Floor(cInt(Fields!CasesOrdered.Value / Fields!CasesOnPallet.Value))) + " Pallets " + cStr(Fields!CasesOrdered.Value Mod Fields!CasesOnPallet.Value) + " Cases"

But this didn't change anything.

What are your thoughts?

-EDIT-

I used the cInt to remove the decimals

=cStr(Floor(cInt(Fields!CasesOrdered.Value / Fields!CasesOnPallet.Value))) + " Pallets " + cStr(cInt(Fields!CasesOrdered.Value Mod Fields!CasesOnPallet.Value)) + " Cases

|||

Try this:

=cStr(Floor(Fields!CasesOrdered.Value / Fields!CasesOnPallet.Value)) + " Pallets " + cStr(cInt(Fields!CasesOrdered.Value Mod Fields!CasesOnPallet.Value)) + " Cases

I should have used the Floor function on the Pallets calculation (instead of cInt). Then, the cInt on the Cases will remove the decimals.

Hope this helps.

Jarret

|||Perfect! Everything works exactly like is should now. Thanks for your henp.

No comments:

Post a Comment