Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi all,
I facing a problem while using if else statement.
here my code
stringvar halfshare := ToText({DataNormal.IsHalfShare});
stringvar margin := ToText({DataNormal.Margin});
 
if halfshare = "0" then
margin & "      " & "S"
else if halfshare = "1" then
margin & "      " & "H"
else 
margin & "      " & "R";
 
I have declaring the variable as above in the formula bar of crystal report. But my output is only display the last statement which is
margin & "      " & "R"
.
Can anyone tell me where is my problem/error?
Posted 7-Jan-13 18:39pm
Des DC533
Comments
Aarti Meswania at 7-Jan-13 23:58pm
   
comment if-else portion and just print
halfshare variable
it will always having value Except 0 and 1 that's why it always goes in last else part and printing
margin & " " & "R"
value
Sergey Alexandrovich Kryukov at 8-Jan-13 0:23am
   
Those are not statements, but expressions. Do you know the difference? :-) There are no statements, which is wrong.
—SA
Des DC at 8-Jan-13 1:01am
   
Aarti Meswania,my database information is saved as 0,1 or 2 in {DataNormal.IsHalfShare}. so i want the system to differentiate it.
Des DC at 8-Jan-13 1:01am
   
Sergey Alexandrovich Kryukov,really?because my database is saved as 0,1,2 in {DataNormal.IsHalfShare}.so i wish to display it in S,H or R.
thomasriley at 9-Jan-13 8:52am
   
replace the last else with - OrElse
Des DC at 9-Jan-13 19:59pm
   
Hi,guys.
sorry for late.
I solved my problem.
My solution is convert it into char first before retrieve into crystal report. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 419
2 OriginalGriff 360
3 CHill60 310
4 CPallini 275
0 Sergey Alexandrovich Kryukov 10,017
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076


Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100