I have a field which is a Double. For display on a the report, if that value is negative, then I need to reverse the number by multiplying it by -1. The result should be formatted like this: "(1,000)" (notice no "-" sign). How can I do this in Crystal? I was using a Display String formula to try to do this since the "Reverse sign for display" option doesn't work for me (because it needs to be a formula for other reasons).
So far I have:
if {columnName} < 0 then
"(" & ToText({columnName}, "#,###", 0) & ")"
else
"(" & ToText({columnName} * -1, "#,###", 0) & ")"
But this gives me something like this: "(-6,500)", and I need to get rid of that pesky minus sign.
Edit:
I implemented a formula field like this:
-Abs({columnName})
Then selected the format that looks like (1,234) from the format list as Craig answered below.
Crystal Reports supports 'accounting' formatting w/o much effort:
right click field, select Format Field...
select Number tab (if not selected)
choose the style that resembles '(1,123.00)'
** edit **
You can also apply this formatting to a formula field.
I have accomplished my requirement this way< I have added a formula and assigned sum of the required field then I set its Format (12,34.00) also i have removed Dollar sign.
Formula = replace(totext(Sum({myfield}) * -1),"$","")
I have face same pro blame but it OS specific . ON windows xp no any formatting problem but above xp this issue face. Use following formula in Display Formula after removing all formatting .
Replace(Replace(Replace(ToText (CurrentFieldValue, "##,##,##,##0.00", 2),"$",""),"-",""),",","")
Related
My summary field displays dollars. If the value is zero, I want to display a dash without the $ symbol. I currently have in the custom style settings to Show Zero Values as a "-", however, what I get in the report is "$-"
I see that there is a conditional formatting option, but I'm not sure how to refer to the summarized field in the code. How can I accomplish this?
Right click on the given field, go to Format Editor, and select Custom Style. Then click Customize... and Enable Currency Symbol. Click the X+2 button and enter the following formula:
If {yourFieldName} >= 0 Then
crFloatingCurrencySymbol
Else
crNoCurrencySymbol
If you prefer a fixed currency symbol, you can use crFixedCurrencySymbol instead of crFloatingCurrencySymbol.
I have a field year which is string type coming from db side.So I converted that to number and adding 1 more year to that to show like this:
Year:2014-2015
Below is the formula.
'Year' & ':' & tonumber({FocusOnCustomer.YEAR})&'-'&(tonumber({FocusOnCustomer.YEAR})+1)
Everything is working fine in designer.But when I view the report in cr viewer I am getting data like this.
2,014.00-2,015.00
I want to remove decimals and comas
Try:
ToText( ToNumber({FocusOnCustomer.YEAR}), "#")
Right-click on the field or formula
Select Format Field
On the Number tab, choose the format to use from the list or click Customize to create a custom format.
Click OK
Website Link
Is there any way to automatically force number of decimal places in an org-mode spreadsheet? So that 42 would be changed to 43.00 when I move to the next field?
Also, is there automatic formatting for thousands separators?
If you want a field to auto-format when changing to the next one, you would need to use the auto-update row header # to indicate that fields in that row should auto-calc whenever TAB S-TAB or RET are pressed in that row (see Org-Manual).
Then if you include as a formula for that cell (I'm assuming that if you are wanting to enter the value manually you will not have a formula affecting that cell usually) that contains (for your 42 -> 42.00 example)
=$0;%.2f
Information before the = sign can be cell or column references depending if you want the formula to be applied to a single cell or to the entire column. (This is mentioned here)
I wasn't able to find any reference to thousands separators in org, it might not be possible at the moment.
This link on Formula Syntax for Calc shows the various options for org-calc-default-modes, which will allow you to change the display format and precision.
Does this help you in any way?
(setq org-calc-default-modes '(calc-internal-prec 12
calc-float-format (float 9)
calc-angle-mode deg
calc-prefer-frac nil
calc-symbolic-mode nil
calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
calc-display-working-message t))
argh!
Can't stand it that i can't figure it out myself....
i've used this in the formatting of a number in my report:
'€' #,0.00;('€' #,0.00)
and that formats to € 1,212.89
which is not exactly what i want, because i want € 1.212,89
regardless of the regional setting of the server.
So i tried this
'€' #.0,00;('€' #.0,00)
but that gives me this:
1.212.890
Typing this i realize that i don't know what the # and the . and the , mean in the format string.....
You can find the definition of the comma and period dynamic behavior here:
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
I think the best way to reliably get what you want is to hard code a locale into the expression for this field.
= (new Decimal(11123.55)).ToString("€#,0.00;(€#,0.00)",
new System.Globalization.CultureInfo("es-ES"))
This will always use the comma as decimal, and period as millions, thousands &c.
There are ways to be more dynamic and always return in the clients local set format, that would usually be preferable.
I know this is an old thread, but in case someone needs it, there is an easiest and most proper way to do it :
Right click on the Textbox of your expression
Select "Number" in the popup "Text Box Properties"
In the "Category", select "Number"
Tick the "Use 1000 separator
Click OK
To "customize" your '1000 separator':
Select the Textbox of your expression
In the Properties on the right, apply the right culture in the "Language" property.
E.g. Select "fr-CH" to have 123'456 otherwise the default is 123,456 as English separator.
Try this out. It will format your value to the correct number of decimal places.
=format(1212.89,"€#,#.00")
For indian currency, in the field value use like =Format(Fields!ServiceTaxAmt.Value,"##,##,##,###.00") and change the language value to hi-in for report property.
You can use the format € #,0.00 and set the language of your report to de-DE by clicking outside of the report area and in the right properties pane go to Localization -> Language.
This Works correctly with [set Language as hi-IN and Format as "##,##,##,###.00"]
Appreciate your Efforts
Also Same can be achieved by following Steps
Go to Text Box Properties
Select Number category in Number Tab
Check the check box beside [Use 1000 separator(,)]
Click Ok
I am trying to customize a money field.
My goal is to achieve this format: -55,555 LEKE
But when I try to customize the currency symbol CR automatically removes the space between my price and the currency symbol (-55,555LEKE). I don't like this format. I tried everything.
Any ideas?
(Sorry for the delay, but your "crystal-reports-xi" tag isn't often used. Otherwise, someone might have answered this sooner).
Go into the Custom Style menu of your field.
Under Currency Symbol, choose Enable Currency Symbol and Fixed.
Change the position to -123$
Close the menu and left-align the field.
Now, all your currency symbols will be on the far right side of your field and the currency will be on the left. This isn't exactly what you're asking for, I know, but it's pretty close.
Alternatively,
Remove the currency symbol from your field entirely.
Make a text object with the currency symbol inside it.
Put the text object to the right of your currency field.
If you want to right-align your field and have that space between the symbol and the currency, this is the way to go.
I'm not sure what you're using to design the report, but in Visual Studio, it's possible to achieve this by modifying the CurrencySymbol property in the property list or setting it programmatically.
Format Field > Number > Customize >Currency symbol -> click on the 'x+2'
and type the following:
totext (' '&'LEKE').
in the field between the apostrophes-- ' '& type as many spaces as you require.
Then save.
Thanks for the answer.
I'd tried the first method you suggested, but it hadn't looked so pretty.
-123 LEKE
But I realized that this problem does not exist in older versions. So I put the currency symbol with Crystal Reports 7, and opened the document with Crystal Reports 11 and completed my design ;) But you should not enter the currency settings after opening with 11 or it swallows the space immediately.