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

Working with cases and partials: a string is required here

Status
Not open for further replies.

rentwistle

Technical User
Apr 23, 2010
3
US
Two issues: 1) It tells me "a string is required here: at the end of the if statement (where the=0 is).

totext (Truncate (if {Product.AlternateUnitConversionFactor} = 0 then 0
else {OrderDetailLot.Quantity} / {Product.AlternateUnitConversionFactor}), 0)
+ "cs" + " " + "/" + {OrderDetailLot.LotNumber}&
If Right (cstr({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor}),2)=0
then "0"
else Right (cstr({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor}),2)*12
+ "p" + Space(3)+ "/" + {OrderDetailLot.LotNumber}

2) Original Question:
I have a question regarding how lot numbers transfer to the reports. I am having an issue where the formula does not read separate lots correctly. For example, I have an order for 721 pounds (12 pounds per case). It is split into two lots, one with 461 and one with 260. It should read 38 cases and 5 partials, and 21 cases and 8 partials. It currently reads 38 cases and 1 partial and 21 cases and 1 partial. Do you know why it would do that? I am assuming it has something to do with how the lots are read...

Current Crystal Formula:
totext (Truncate ({OrderDetailLot.Quantity}/{Product.AlternateUnitConversionFactor}),0)
& "cs" & Space(3) & "/" &
If Remainder ({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor})>0 then totext (Remainder({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor}),0)
& "p" & Space(3)& "/" & {OrderDetailLot.LotNumber} else {OrderDetailLot.LotNumber}
 
You need parens to set off clauses that belong together, but I can't even tell what your intent is with last part of the first formula, since you can't multiple strings and I can't tell what goes with what here:

Right (cstr({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor}),2)*12+ "p" + Space(3)+ "/" + {OrderDetailLot.LotNumber}

Formula 2:

totext (Truncate ({OrderDetailLot.Quantity}/{Product.AlternateUnitConversionFactor}),0)& "cs" & Space(3) & "/" &
(
If Remainder ({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor})>0 then
(
totext (Remainder({OrderDetail.QtyOrdered},{Product.AlternateUnitConversionFactor}),0) &
"p" & Space(3)& "/" & {OrderDetailLot.LotNumber}
) else
{OrderDetailLot.LotNumber}
)

-LB
 
OK- Just with the second formula which you added parens to, the issue is that instead of returning the correct amount of partial cases it always returns just the number one. The issue only occurs when there are two lot numbers for one order. I am using Crystal Reports with ACCTivate! software. If only one lot is used to fill an order, then there is no issue, it returns the correct number of paritals. This is why I am wondering if the formula reacts incorrectly to the two lots for one order issue. Thoughts?
 
I don't understand why you are using a text formula for a calculation. It would help if you showed what the data looks like at the detail level when you place the lot#, quantity and quantity ordered fields on the report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top