Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hey ,
everyone i have this issue which is a simple expression, at the designer end (Front end) is its working fine but at the script level it is not doing the exact calculation as the front end . The calculation here is Amount / Quantity, where in some of the Amount's are negative and some of the Quantity are Zero's, my question is here is these two factors are causing the problem is there any way t resolve this or a better way to write the expression in script.
Thanks,
Shiva
Well, if i understand rightly you have this situation:
Amount/Qunatity
Ex:
Produt A: 12/4 + 6/0
Produt B: 30/10 + (-20)/5 + (-3)/0
If so, you can just replace when Quantity = 0 to =1, about negative Amount value i dont think this is a problem.
your example is right .. and where to replace the quantity?
maybe this ?
Load
IF(Quantity=0,0, Amount / Quantity) as Price
From <TableName>
Try this
Alt(Amount/Quantity,0) as NewField
You can use something like this my friend:
yourtable:
load
field1,
field2,
amount
If(quantity=0,1,quantity) as quantity
from yourqvd.qvd
or in one step like sugest Dave in comment above.
tried this one didn't work .. my expression was like this (if(QTY =0,0,sum(Amount)) /Sum(QTY))as [New Filed] .
is there any thing wrong in my expression? Could You Please Help me out .
Thanks
Shiva
One extra parenthesis closed in advance after first aggregation sum. Try this
(if(QTY =0,0,sum(Amount) /Sum(QTY))as [New Filed]
this expression is saying wrong ..
What do you mean wrong? Throwing any error or returning nothing..