Solved

Remove Comma from Parameter within a Formula

Posted on 2013-06-14
8
705 Views
Last Modified: 2013-06-21
Hey guys,

I have the following formula:

if {?Year}-1 = {Command.FISCAL_YEAR} and {Command.ACCOUNT} = 4000 then {FBDETAIL.DB_UNITS_12}+{FBDETAIL.CR_UNITS_12} else
if {?Year}-1 = {Command.FISCAL_YEAR} then {Command.DB_AMOUNT_12}+{Command.CR_AMOUNT_12}

And it works correctly. The only problem is when the user is prompted, the Year parameter shows a comma. How can I alter the code so that I can remove the comma?
0
Comment
Question by:metalteck
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 39247958
Assuming the parameter is a number, you don't need to remove it.

YOu can try setting the default format for numbers to be -1234 but I don't think that affects the parameter screen.

What is the problem with the comma?

mlmcc
0
 

Author Comment

by:metalteck
ID: 39248028
The user is selecting a year and its coming up as 2,013 instead of just 2013.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39248555
It is a number so to change its display you may have to change the default number display under
FILE --> OPTIONS

You have no control over the parameter entry screen.
If you mean that is the way it displays in the report then just format it to remove the comma

mlmcc
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:metalteck
ID: 39248720
I'v tried changing it under File--options--fields--number, but when I refresh the report and ask for new parameters, its still showing the comma.

I tried converting it to a string, but by doing that, if I try to do year-1, it don't think that will work.

Is there any other way I can use to get rid of the comma?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39248764
None that I know of.

You can use

Val({?Year}) - 1  if you set Year as a string.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 39249832
Assuming that you're running the report from within CR, then it is possible to change the format for numeric parameters, but there are definite caveats.

 Go to File > Options, select the Fields tab, click on Number and then select the Number tab.  The format selected there is used for numeric parameters.

 There are two basic "gotchas":
 1) That setting will affect every numeric parameter in any report that is run from CR.
 2) That sets the default format for any numeric _field_ that is added to a report.


 If you don't want to use that setting, then you could make the parameter a string and then, as mlmcc mentioned, convert the string to a number.  That's what I did for parameters like that.  It helps if you're setting the default values for the parameter and forcing the user to select one of those values.  Then you don't have to worry about the user entering something that is not a valid number.  If the user is typing in the value, you may want to add some basic "sanity checks", to make sure that you don't end up with a problem value.

 James
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 39266206
I agree with mlmcc - this is how I get around the "ugly" format for years. I set the parameter input type to be string, and then convert it to numeric in the record selection.

I would probably add an if to confirm format in record selection - i.e.: if someone times ABCD instead of 2013, the report will error without a condition to check for that.

{table.field} = (  IF isnumeric({?Year})=false THEN 1900 ELSE tonumber({?Year}) )
0
 
LVL 34

Expert Comment

by:James0628
ID: 39266307
FWIW, you could use Val (as mlmcc did) instead of ToNumber.  Then at least you wouldn't get an error if the string was not a number.  You just get 0.  Whether or not that's a problem depends on the report, data, etc.  If you're just comparing it to a year field (and every record has a valid year), then you'd just get no data, which might be acceptable.

 James
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

778 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