Print Page | Close Window

field selected depends on value in another field

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=12560
Printed Date: 02 May 2024 at 6:09pm


Topic: field selected depends on value in another field
Posted By: 00331data
Subject: field selected depends on value in another field
Date Posted: 09 Mar 2011 at 1:58pm
How can I create a fomula for the following (which I'm explaining in half formula-speak and half plain English):
 
IF {field.A} = "red" or "blue" 

     then  insert the words "Object Type:   " and concatenate with {field.B}

    

else  (that is to say if {field.A} equals anything else)

   insert the words  "Title:  "  and concatentate with {field.C}

 
I made this formula:

IF

     {field.A} = "red" or "blue"

then 

     "Object Type:  " & {field.B} 

else

     "Title:  " & {field.C}
 
It is incorrect; is this a syntax problem?
 
Thanks...


-------------
thanks,
00331data



Replies:
Posted By: FrnhtGLI
Date Posted: 10 Mar 2011 at 2:10am
I believe you have to restate the other side of the equation again after the or. So:
 
If ({field.A}='red'
or {field.A}='blue')
     then 'Object Type: ' & {field.B}
          else 'Title: ' & {field.C}


-------------
|< /\ '][' ( )


Posted By: Keikoku
Date Posted: 10 Mar 2011 at 2:45am
As FrnhtGLI, you must specify *exactly* what the conditions are.

In english, when I say "is the ball red or blue?" you would probably automatically translate that as "is the ball red or is the ball blue?"

This translation occurs for some reason and in fact the original question could be ambiguous. From my question you could have asked "what's blue?" and I would have to clarify that I am referring to the ball.

Of course, the computer isn't going to ask you what you meant, so it'll just tell you it doesn't know what you're talking about.


Posted By: 00331data
Date Posted: 12 Mar 2011 at 10:20am
Thanks for these great responses--all makes sense & formula, of course, works!

-------------
thanks,
00331data



Print Page | Close Window