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.
Related
I'm using a Crystal Report connected with VB.NET 2010, here I using a Line object, which I need to show or hide depending on data field. Where do I need to set the formula?
This project I use is running with SQL 2008 and VB.NET 2010. I've tried some Formula Field for this topic. But the result is not look like that I want to show.
I use the following code on Formula Field:-
IF isNull({PrintParticularList.CUST_INVOICE_No}) or {PrintParticularList.CUST_INVOICE_No}=""
THEN
""
ELSE
"--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
I also try this following Code :-
IF isNull({PrintParticularList.SLNO}) or {PrintParticularList.CUST_INVOICE_No}=""
THEN
Line25.Suppress=True
ELSE
Line25.Suppress=False
But here I got error on Line25.
A number, currency amount,boolean, date, time, date-time, or string is
expected here.
In the Report Designer use the Insert Line tool to draw the line where you want it to appear on your report. The right-click the line object and select "Format Line..." to open the Format Editor dialog box. On this window you will find a check box labeled "Suppress" with an X-2 button to the right. Click the X-2 button and this will open a Formula Workshop window where you will enter the formula that determines if this drawing object should be suppressed or not.
I would recommend the following formula based upon your previous attempts at creating one.
IF isNull({PrintParticularList.SLNO}) or {PrintParticularList.CUST_INVOICE_No}="" THEN
True
ELSE
False
-----EDIT-----
Since you don't have the X-2 button I have 2 more ideas.
1.) Take the 1 section you current have and split it into 3 sections. Then you could place all the content above the line in the first section, place the line in the second section, and the content below the line in the third section. They use the formula to suppress the second section when the line is not needed.
2.) Insert a blank text box in place of the line and set either the top or bottom border of the text box to a single line. Then use the suppress formula to determine if the text box should be shown or hidden.
How can I remove the comma (,) from crystal report fields?
I have a field name "year" which is having a value of 2012, but when I show that value in crystal report it includes a comma, becoming 2,012.
How can I show only 2012?
In the crystal report designer view:
Right mouse click on that field, and select Format object. Select Custom Style in the Style list, and click Customize. Untick Thousands Separator, and any other unwanted formatting.
Failing that, you could try selecting the field and deleting the "," value from the property ThousandSeperator in your properties window.
try this
for formula
ToText( ToNumber({variable1}), "#" )
Try below code,
Replace (ToText ({Tablename.Year_Field}, 0),"," ,"" )
I'm just guessing but I believe you have embedded your field name into another object such as a text field.
If this is the case, double click your text box in the design view, then select your text field you are having issues with. Right click and select "Text Formatting", under the Font tab click the 'Format Formula Editor' button (the one with the X-2) to the right of the Font drop down menu. Now all you have to do is close the formula editor, then cancel the Text Format window. NOW when you right click on your year field again you will have a new option to Format the field which was previously grayed out.
Alternatively, you can remove your year field from any other object it is nested in. This will give you access to all formatting options.
NumberVar cRed;
ToText (cRed,"#")
OR
ToText({some numeric field value},"#")
The "#" has to be enclosed in parenthesis, single or double.
I am building a subreport and have two tables from which I am using one field each containing a phone number.
Original Number {TABLE1.ORG}
Temporary Number {TABLE2.TEM}
What I want:
If {TABLE2.TEM} is not null, then hide {TABLE1.ORG}, else show {TABLE1.ORG}
I tried to use the above as a formula but it doesn't work too Since these both fields are from two different tables if place them next to each other (without any formulas or suppression) in the design mode:
{TABLE1.ORG} {TABLE2.TEM}
...I see them on different lines in preview mode:
+971 4 321321321
+971 4 123123123
Maybe because the formula reads records and evaluate from the same line, I guess this is the reason why above is not working correctly.
It's not obvious why the two fields are appearing on different lines in preview mode, but it's unlikely to be because they are from different tables - it's more likely to be because there isn't enough room in the layout for them both to display in one line, and so they are growing to a size that canb be displayed.
To conditionally suppress {TABLE1.ORG} based on whether the other field is not null:
right-click on {TABLE1.ORG} and select Format Field...
in the Common tab within the Format Editor dialog, click on the conditional suppress formula button x-2 and enter the formula not IsNull ({TABLE2.TEM}) in the Format Formula Editor.
click Save and close to exit from the Format Formula Editor, then click OK to exit the Format Editor dialog.
If you now preview the report, you should find that {TABLE1.ORG} is suppressed where {TABLE2.TEM} is not null.
Note that if you make display of both fields conditional on whether the other is null, then both will be suppressed where neither is null.
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.