5 Replies Latest reply on Jul 29, 2011 10:54 AM by philmodjunk

Calculation Malfunction

Title

Calculation Malfunction

Post

Does anyone see anything wrong with this calculation? Is the Vendor = "RRD" & PS:CoverPageCt = "4" part "illegal?" Everything works fine if I take that part out, so my next question is how do I write this calculation so that I can have two criteria together?

Case ( Book Name Canceled = "canceled"; ""; PS:CoverPageCt = 0 ; "" ;Vendor = "RRD" & PS:CoverPageCt = "4"; PrintForecast::PF_Cover_Run_Press_Four_Rate_RRD * (Circulation / 1000) + (PrintForecast::PF_Cover_Run_Press_Four_Charge_RRD * PrintForecast::PF_Offset_Forms_Main ))

• 1. Re: Calculation Malfunction

It's not illegal. It just won't evaluate the way it expects. It will evaluate from left to right one comparison at a time.

Vendor = "RRD" & PS:CoverPageCt will evaluate as either True (1) or False (0) before this is compared to "4". I imagine the result you'll get in every case is 0 (False) as neither 1 nor 0 will ever equal "4".

If you can explain what you intended this expression to return, it should be possible to suggest and alternate expression that does what you want.

• 2. Re: Calculation Malfunction

I figured this out. Rather than & it should be "and". But I understand your explanation and it did help explain why the & doesn't work.

• 3. Re: Calculation Malfunction

Is CoverPageCt a field of type number or of type text. It looks like it should be of type number and in either case, you can also remove the quotes from around the 4.

• 4. Re: Calculation Malfunction

Type number, and thanks for the quote info.

• 5. Re: Calculation Malfunction

In your specific case, it doesn't really matter, but when you start using inequalities like > or <, it can make a big difference as "2" evaluates as greater than "1000" due to them being treated as text instead of numbers when they are in quotes or stored in fields of type text.