Home
Crystal Reports Training
Crystal Reports XI
Crystal Reports .NET
Crystal Reports Forum
News
Tech Support
Active Topics
Memberlist
Search
Help
Register
Login
Technical Questions
Crystal Reports Forum
:
Crystal Reports 9 through 2022
:
Technical Questions
Topic: Formula error with NULL result
Author
Message
kezza
Newbie
Joined: 08 Mar 2012
Location: Netherlands
Online Status: Offline
Posts: 19
Topic: Formula error with NULL result
Posted: 21 Aug 2014 at 1:41am
Hello everyone,
I have a report with a formula field. But when this field is NULL (empty) i want to show a result of another formula.
So by the Display String I have made the following formula, but then I get the error "A statement is expected here"
Here is the formula:
if {@formula1} ="" then {@formula2}
else {@formula1}
Thanx!
IP Logged
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Posted: 21 Aug 2014 at 2:01am
if isnull({@formula1}) then {@formula2}
else {@formula1}
IP Logged
kezza
Newbie
Joined: 08 Mar 2012
Location: Netherlands
Online Status: Offline
Posts: 19
Posted: 21 Aug 2014 at 2:26am
Thank you, but I still get the error. I'm using Basic Syntax
IP Logged
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Posted: 21 Aug 2014 at 2:40am
try changing to it crystal syntax?
IP Logged
kezza
Newbie
Joined: 08 Mar 2012
Location: Netherlands
Online Status: Offline
Posts: 19
Posted: 21 Aug 2014 at 2:56am
Then I get the error:
the formula result must be a string
IP Logged
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Posted: 21 Aug 2014 at 3:10am
is the result of {@formula2} a string, and {@formula1} something else?
You can fix that by changing the formula to:
if isnull({@formula1}) then {@formula2}
else totext({@formula1})
IP Logged
kezza
Newbie
Joined: 08 Mar 2012
Location: Netherlands
Online Status: Offline
Posts: 19
Posted: 21 Aug 2014 at 4:09am
They are both numberfields. The formula you mentioned won't work either. Error: a number is required here
IP Logged
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Posted: 21 Aug 2014 at 4:17am
Okay ignore the last part (to totext).
When you are getting the error message, is it referring you to part of the formula?
IP Logged
kezza
Newbie
Joined: 08 Mar 2012
Location: Netherlands
Online Status: Offline
Posts: 19
Posted: 21 Aug 2014 at 4:35am
When i ignore the last part i get "the formula result must be a string" It's not referring to a part of the formula
IP Logged
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 21 Aug 2014 at 8:16am
what is the syntax for formula1 and formula2?
and if they referance more formula please include those.
IP Logged
Printable version
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
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
HOME
|
FREE EBOOK
|
PROGRAMMING GUIDE
|
PURCHASE
|
REVIEWS
|
CONTACT ME
|
FAQ
|
LINKS
|
PRIVACY
|
CLICK PLAYS
|
KONACAD
© 2004-2026 Brian Bischof. All Rights Reserved.