Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Field Calculation

Status
Not open for further replies.

nayfeh

Programmer
Mar 13, 2002
163
CA
Hi,

I have a report that gathers data from a stored SQL procedure. One of the fields is "QtyOrderd". This lists the units ordered for each "ProductNbr".

I need to have a field that calculates the "TotalSkids" value. What this is, is OtyOrdered divided by 108 . Then, I need to get the remaining value and record that as a separate field in the report called "QtyLeftover". If the values of QtyOrdered is less than 108, say 64, then TotalSkids = 0 and QtyLeftover = 64.

Looks something like this:(For Quantities of 110 and 138)
----------------------------
ProductNbr TotalSkids
1 1
2 2
----------------------------
ProductNbr SkidsLeftover
1 2
2 30
----------------------------

Your help is appreciated.

Thanks,
TN
 
I'm not quite sure why you have 2 for your TotalSkids in your example for ProductNr 2. 138/108 = 1 TotalSkid and 30 leftover. To calculate each one you can use these expressions.

TotalSkids = Int(QtyOrdered/108)
SkidsLeftover = QtyOrdered Mod 108

Paul

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top