If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Cast Formula Help

Started by gatorfe, 10 Jan 2014 12:45:55 PM

Previous topic - Next topic

gatorfe

We are trying to get this formula to work.  We keep getting a parse error.

if(cast([Stock Forecast].[Record Id], numeric)=2)  and cast([Stock Forecast].[Order Type], numeric) = 9)
then
([Stock Forecast].[Open Quantity] * -1)
else
[Stock Forecast].[Open Quantity]

Record ID and Order Type are varchar fields and open qty is numeric.  Thank you in advace for any suggestions!


HalfBloodPrince

if( cast([Stock Forecast].[Record Id], numeric)=2)  and cast([Stock Forecast].[Order Type], numeric) = 9) )
then
([Stock Forecast].[Open Quantity] * -1)
else
([Stock Forecast].[Open Quantity])

Francis aka khayman


gatorfe

Thank you for the info.  It seems to be off though.  If we just do it with one cast it works but when we add the other it does not want to work.  Any suggestions?
This is what works:if (cast([Stock Forecast].[Record Id], numeric) =2 )
then
([Stock Forecast].[Open Quantity] * -1)
else
([Stock Forecast].[Open Quantity])

Does not work:if (cast([Stock Forecast].[Record Id], numeric) =2 )
and
if (cast ([Stock Forecast].[Order Type], numeric) = 9)
then
([Stock Forecast].[Open Quantity] * -1)
else
([Stock Forecast].[Open Quantity])

Does not work:
if (cast([Stock Forecast].[Record Id], numeric) =2 )
and
cast ([Stock Forecast].[Order Type], numeric) = 9
then
([Stock Forecast].[Open Quantity] * -1)
else
([Stock Forecast].[Open Quantity])

Does not work:
if (cast([Stock Forecast].[Record Id], numeric) =2 )
and
(cast ([Stock Forecast].[Order Type], numeric) = 9)
then
([Stock Forecast].[Open Quantity] * -1)
else
([Stock Forecast].[Open Quantity])

MFGF

Hi,

How about:

if (cast([Stock Forecast].[Record Id], numeric) =2
and
cast ([Stock Forecast].[Order Type], numeric) = 9)
then
([Stock Forecast].[Open Quantity] * -1)
else
([Stock Forecast].[Open Quantity])

MF.
Meep!