Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie varibles question 1

Status
Not open for further replies.

rlfearns

Technical User
Oct 25, 2004
4
US
I am totally new to crystal reports, just saw it 4 days ago for the first time. We are also a start up company so we are using CR 4.0 (it's paid for) and I'm not a programmer. I am connecting to a mySQL database.

What I am trying to do is if a field returns a number have it print a text value. What I have tried is:

state1: = Open
state2: = In Progress
state3: = Solved
state4: = Closed

if {bugs.state} = 1
then {bugs.state} = state1

When I hit the check button I'm getting "the remaining text does not appear to be part of the formula". I will admit to flying blind here, I have located a "Dummies" book but it hasn't arrived yet. Could someone point me in the right direction? Thanks in advance

 
I've got 4.6 somewhere, but not here. I think that the variable declarations have remained consistent over all versions though. Try this:

StringVar state1 := 'Open';
StringVar state2 := 'In Progress';
StringVar state3 := 'Solved';
StringVar state4 := 'Closed';

if {bugs.state}= 1 then
state1
else if {bugs.state}= 2 then
state2
else if {bugs.state}= 3 then
state3
else if {bugs.state}= 4 then
state4
else
'Default text here'

-dave
 
Not sure if you can do this in CR4 but in 8.5

if {bugs.state} = 1
then "Open"
else if {bugs.state} = 2
then "In Progress"
else if {bugs.state} = 3
then "Solved"
else if {bugs.state} = 4
then "Closed"
else "Invalid Value"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top