Help with If then formula (1 Viewer)

js3

New member
Local time
Today, 14:03
Joined
Feb 1, 2012
Messages
1
I need help converting a simple If then formula that is used in Crystal 8.5 to Crystal 10. Below is the formula as I would write it in 8.5

IF{INMAST.Prodkey}IN ['P12','P13','P14','P15','P24','P28','P32','P33','P34'] THEN BU01 else
if {INMAST.Prodkey}IN['P01','P03','P04','P05','P07','P11','P19','P26','P29',P30','31'] THEN BU02 else
if {INMAST.Prodkey}IN ['P08','P20','P23','P27','P36','P37','P38','P39'] THEN BU03 else
if {INMAST.Prodkey}IN ['P21'] then BU04 else
if {INMAST.Prodkey}IN ['P16','P25'] then BU00

when I entered this everything after the first [ turned green which is what happens in 8.5 when you use // I changed all the sqare brackest to " which fixed that problem but then when I ran a check on the formula it stoped me right after the first then and said a statement is required. I tried "BU01" and 'BU01' as well. What am I doing wrong.

Thank you
 

MSAccessRookie

AWF VIP
Local time
Today, 17:03
Joined
May 2, 2008
Messages
3,428
I need help converting a simple If then formula that is used in Crystal 8.5 to Crystal 10. Below is the formula as I would write it in 8.5

IF{INMAST.Prodkey}IN ['P12','P13','P14','P15','P24','P28','P32','P33','P34'] THEN BU01 else
if {INMAST.Prodkey}IN['P01','P03','P04','P05','P07','P11','P19','P26','P29',P30','31'] THEN BU02 else
if {INMAST.Prodkey}IN ['P08','P20','P23','P27','P36','P37','P38','P39'] THEN BU03 else
if {INMAST.Prodkey}IN ['P21'] then BU04 else
if {INMAST.Prodkey}IN ['P16','P25'] then BU00

when I entered this everything after the first [ turned green which is what happens in 8.5 when you use // I changed all the sqare brackest to " which fixed that problem but then when I ran a check on the formula it stoped me right after the first then and said a statement is required. I tried "BU01" and 'BU01' as well. What am I doing wrong.

Thank you

I cannot remember if the type of quote makes a difference, and I do not have CR 8.5 or CR 10 to test, but I have never used a single quote (') in that situation. I use a double quote (") instead.

Try leaving the brackets ([, ], {, and }) alone, and changing the single quotes (') to double quotes (") to see if there is any difference.
 

kevlray

Registered User.
Local time
Today, 14:03
Joined
Apr 5, 2010
Messages
1,046
First off there is a missing quote on line two before the P30. Second, you will need to enclose the BU01, BU02, etc. in single or double quotes.
 

Users who are viewing this thread

Top Bottom