Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: IF statement Post Reply Post New Topic
Author Message
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Topic: IF statement
     Posted: 06 Oct 2011 at 1:19am
What is the correct syntax for multi rows in an if statement as I keep getting problems
 
How is this done
 
If Len(Of a Field) > 1 then
Address = "ABC"
SomethingElse = "1234"
else
Address = "DEF"
SomethingElse = "9876"
endif
 
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 06 Oct 2011 at 3:26am
IF Len({table.field}) >1 THEN "ABC" ELSE
IF Len({table.field}) >2 THEN "DEF" ELSE
IF Len({table.field}) >3 THEN "GHK" 
 
 
so basically, IF {argument} THEN {returnvalue} ELSE
 
 
you wont need the 'endif'

simply leave off the last ELSE
 
 


Edited by Robotacha - 06 Oct 2011 at 3:28am
Regards,

Michael Jones
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 06 Oct 2011 at 3:30am
If you want mulitple return values then use:
 
IF Len({table.field})>1 THEN {table.address}="ABC" AND {table.somethingelse}="1234" ELSE


Edited by Robotacha - 06 Oct 2011 at 3:35am
Regards,

Michael Jones
IP IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Posted: 06 Oct 2011 at 3:31am
Thanks for both these solutions and a speedy reply.

Edited by Central - 06 Oct 2011 at 3:32am
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