Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Reports Formula Error 'A Number is Required Here'

Posted on 2009-04-07
3
Medium Priority
?
3,191 Views
Last Modified: 2012-05-06
Hi, I'm trying to construct a very simple formula in Crystal Reports that will only display the value if it is greater than zero. This is the formula I have: -
If {Client.Units} <> 0 then {Clients.Units} else ""
I get 'A number is required here' error.
Have tried this too: -
If {Clients.Units} = 0 then "" else {Clients.Units}
For this I get a 'String is Required Here' error!
I'm sure this is very simple to resolve but I'm relatively new to Crystal and any help would be greatly appreciated.
Thanks in advance.
0
Comment
Question by:bdoshuk
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 1000 total points
ID: 24087463
The outputs from an if..then..else.. must be the same datatype - all strings, all numbers, all dates or whatever.

In this case you do not need a formula field at all.
You right-click the Units field and choose Format Field.
You can then check the Suppress when zero option which you will find on the Customize button of the Number tab.
0
 
LVL 10

Expert Comment

by:dougvarga
ID: 24087474
Becuase {Clients.Units} is a number, the "else" clause must also return a number.

If you are trying to suppress this field if zero, you should use a number format instead.

Place the {Clients.Units} on the report, right click and select Format Field
Click on the number tab and then customize button.

put a Check in suppress if zero.

0
 

Author Closing Comment

by:bdoshuk
ID: 31567507
Many thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question