Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Nested If in Crystal XI Post Reply Post New Topic
Author Message
grego
Newbie
Newbie
Avatar

Joined: 22 Feb 2008
Location: United Kingdom
Online Status: Offline
Posts: 16
Quote grego Replybullet Topic: Nested If in Crystal XI
     Posted: 11 Jun 2008 at 2:57am
For some reason I get a "number is required here message" next to the last if in this statement.
 
There are basically two transaction types in my data set FX and SE.
If the data is FX and the {transrpt.CCY} = USD I want the field {transrpt.FXNAT2} returned else if the field {transrpt.CCY2}=USD I want the field {transrpt.FXNATURAL} returned.  Else if the Transaction type is SE I want the vaule 0 returned
 
I always seem to get these nested IF's wrong in crystal and am never quite sure why!
 
Here is the code below:
 
 
If ({transrpt.TRANS_TYPE}="FX" and {transrpt.CCY}="USD") then {transrpt.FXNAT2} else if ({transrpt.TRANS_TYPE}="FX" and {transrpt.CCY2}= "USD") then {transrpt.FXNATURAL}
else if {transrpt.TRANS_TYPE}="SE" then "0" else "NA"
 
 
Any help would be greatly appreciated!
IP IP Logged
ashisahb
Groupie
Groupie


Joined: 15 May 2008
Location: India
Online Status: Offline
Posts: 48
Quote ashisahb Replybullet Posted: 11 Jun 2008 at 3:18am
Grego,
 
Check out if the field u are publishing is Number Or String.
Try publishing those fields by converting in text format by applying totext().
 
Try this...
 
If ({transrpt.TRANS_TYPE}="FX" and {transrpt.CCY}="USD") then totext({transrpt.FXNAT2}) else if ({transrpt.TRANS_TYPE}="FX" and {transrpt.CCY2}= "USD") then totext({transrpt.FXNATURAL})
else if {transrpt.TRANS_TYPE}="SE" then totext("0") else totext("NA")
Regards,
Ashish
IP IP Logged
grego
Newbie
Newbie
Avatar

Joined: 22 Feb 2008
Location: United Kingdom
Online Status: Offline
Posts: 16
Quote grego Replybullet Posted: 11 Jun 2008 at 3:28am
worked - thanks very much for your help
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