Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If then else statement in Crystal Post Reply Post New Topic
Author Message
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Topic: If then else statement in Crystal
     Posted: 30 Mar 2010 at 6:21pm
Hello,
 
I am receving an error message i.e. 'A string is required here' for the last row in my script (highlighted below in bold).  I am using Crystal Syntax however am not sure what the correct syntax is.
 
I would really appreciate any assistance with this
 
Regards,
Despina
 
 

if {Query1.Outline Agreement Work Detail}=" CASUAL LOADING 22.5%" then
"CASUAL LOADING 22.5%"
else if {Query1.Outline Agreement Work Detail}="15% SHIFT/CAS LOAD " then
"15% SHIFT/CAS LOAD "
else if {Query1.Outline Agreement Work Detail}="30% SHIFT/CAS LOAD " then
"30% SHIFT/CAS LOAD "
else if {Query1.Outline Agreement Work Detail}="50% SHIFT/CAS LOAD " then
"50% SHIFT/CAS LOAD "
else if {Query1.Outline Agreement Work Detail}=" PUBLIC HOLIDAY " then
" PUBLIC HOLIDAY "
else if {Query1.Outline Agreement Work Detail}="100% SUN SHIFT " then
"100% SUN SHIFT "
else if {Query1.Outline Agreement Work Detail}=" OVERTIME 1.5" then
" OVERTIME 1.5"
else if {Query1.Outline Agreement Work Detail}=" OVERTIME 2.0  " then
" OVERTIME 2.0  "
else if {Query1.Outline Agreement Work Detail}=" Meal Allowance " then
" Meal Allowance "
else if {Query1.Outline Agreement Work Detail}=" USA - Unpaid Time " then
" USA - Unpaid Time "
else
{Query1.Outline Agreement Work Detail}=" Invalid Code "
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 Mar 2010 at 7:04pm
The last line is a returning a boolean value of whether the work detail is equal to "Invalid Code" or not. If all the conditions fail and you just want to return the "Invalid Code" string then do this:

else
" Invalid Code ";


Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Posted: 31 Mar 2010 at 11:54am
thankyou very much I tried this and it works
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum