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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating A whole number from two fields

Status
Not open for further replies.

enbw

Technical User
Mar 13, 2003
296
Hi,

I am trying to write a report which will suggest a production qty. I will have an Order qty which has been entered against a part. The part will have associated with it two fields one representing planned scrap and the other a number of parts produced per cycle.

For example;

An order qty of 10 against PART A.
Part A has a planned scrap figure of 4%
Part A has a cycle quantity of 4.

I know the order in which calculation is need to perform. The first is to calculate the production qty including the scrap. This would be effectively 10 * 1.04 and then rounded up to the next whole number, in this case 11, irrespective of the fraction.

The second part would be to make this number exactly diversible by the cycle quantity, 4. So I believe that I need a loop which would test this. So crystal would take the 11 and add 1. It would then divide by 4. If the resultant is a whole number then it would suggest production qty. In this case it would get to 12. Then divide 4. The resultant would be 3 which is a whole number.

Am using CR 8.5 Thanks in advance.
 
Hi,

Have managed to do this... don't know how well though.. if anybody is interested I will post it.
 
try this

numbervar suggprodqty;
suggprodqty := round(round((({order qty}*(1+{scrappercent}/100))+.5),0)/{cycleqty},0 )*{cycleqty}

Note: adding the .5 will round up.
fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top