Print Page | Close Window

"in" and "not in" formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16351
Printed Date: 18 May 2024 at 5:26pm


Topic: "in" and "not in" formula
Posted By: bluelake
Subject: "in" and "not in" formula
Date Posted: 04 May 2012 at 7:24am
I have three multi-select dictionary fields and I want to create a numeric so that I can sum the responses.  This isn't returning any value:

if "10" in {field A}
then 1

else if "10" in {field A}
and  "10" in {field B}
then 0

else if "10" in {field C}
then 1

else 0



Replies:
Posted By: amanda5615
Date Posted: 04 May 2012 at 8:00am
Try this:
if {field} like "*10*" then 1 else if {field} like "*10*" and if {field2} like "*10*" then 0 else if {field3} like "*10*" then 1 else 0


Posted By: lockwelle
Date Posted: 04 May 2012 at 10:03am
just a logic note...you probably want to check the condition in field a & b first, then field a, then field c.
 
currently, if the value is in field a & b, you will get a 1, and not the 0 that you were expecting.



Print Page | Close Window