Chrystal report expression

The following expression does not return any data after the giftnote. I been making subtle changes and trying different things, but can't get it to work. I have set default values for nulls. I have tried with and without else.

"Gift designation: " + {FUND.FUND_TITLE}+ " (Fund number: " + {GIFT.FUND_ACCT} + ")"
+ chrw(13) + chrw(10)
+ if {@GiftNote} > "" then "Gift Note: " + {@GiftNote} + chrw(13) + chrw(10) else ""
& if sum({GIFT.PREM_VAL})>0 then "Premium Value: $" + cstr(sum({GIFT.PREM_VAL})) & chrw(13) & chrw(10) else ""
& if {WILL.CSV}>0 then "Charitable Deduction: $" & cstr({WILL.CSV} )else ""
KSUFAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_TAD_Commented:
Personally I always found it a bit easier to use IIF.   It doesn't change the logic, but I always found it easier to read (and I never lost a parenthesis.

Also, I see that you switch between + and &.  You will want to stay consistent

+ IIF( {@GiftNote} > " ", "Gift Note: " + {@GiftNote} + chrw(13) + chrw(10) , " ")
+ IIF( sum({GIFT.PREM_VAL})>0,  "Premium Value: $" + cstr(sum({GIFT.PREM_VAL})) + chrw(13) + chrw(10), " ")
+ IIF( {WILL.CSV}>0, "Charitable Deduction: $" & cstr({WILL.CSV} ) , " ")
mlmccCommented:
The problem is everything after the ELSE is considered part of the ELSE.  You need to use ( ) to control the parsing

"Gift designation: " + {FUND.FUND_TITLE}+ " (Fund number: " + {GIFT.FUND_ACCT} + ")" 
 + chrw(13) + chrw(10) 
 +
(
	if {@GiftNote} > "" then 
		"Gift Note: " + {@GiftNote} + chrw(13) + chrw(10) 
	else 
		""
)
 & 
(
	if sum({GIFT.PREM_VAL})>0 then 
		"Premium Value: $" + cstr(sum({GIFT.PREM_VAL})) & chrw(13) & chrw(10) 
	else 
		""
)
 & 
(
	if {WILL.CSV}>0 then 
		"Charitable Deduction: $" & cstr({WILL.CSV} )
	else 
		"" 
)

Open in new window


mlmcc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KSUFAuthor Commented:
Thank you! I've been fighting this for hours...so simple...wish I'd have thought of it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.