how to set number separated by comma in crystal report - crystal-reports

How to set number in crystal report separated by commas.
There is a provision for thousand separator. But actually i need the number in the form like the below example.
Eg : 12,34,556.00
not like 1,23,456.00

What you probably want is Indian currency format i.e Lakhs and not Millions.
This is based on your culture information.
You can use a formula to format each field. Right-click on one of your numeric fields, select "Format Field" and select the Common tab. Click on the formula (X+2) button to the right of "Display String" near the bottom and enter a formula like:
CStr (CurrentFieldValue, "#,##,##,##,##,###.00")
Give this a try and see if it displays correctly.

Related

SAP Crystal Report - How to override default formating for number and currency field in formula

I am using tonumber function but its adding default formatting and i don't want that mainly thousand separator.
Also, for currency, I don't want currency symbol.
As I am using these fields in formula field, I cannot set properties, right?
To remove the thousand separator, I generally do something like
Replace(ToText(YourField),',','')
To remove currency symbols do the same
Replace(ToText(YourField),'£','')

Crystal Report - Placing decimal point

I'm getting an integer value as 2345 but I want to display it as 234.5
is it possible??
To get what you are looking for in a simple fix is like what kingpin stated above. Divide the value by ten. To do this just create a new formula in crystal by going into your field explorer and right clicking on the formula fields section. Under there should be a option to create a new formula. Then in window that comes up put the field you want to manipulate in the formula and then divide that by ten. And there you go. Now use the formula field in the report instead of the original field.
Here is a example of how it could look.
{Table_Foo.value_Bar} / 10
There is a field property for it. Don't have access to crystal reports at the moment, but I know it's there:
Crystal Report Provides an easy to use default thousand separator for numeric Fields. You can use it by checking Thousand Separator from Field Properties.
If you need a customized separator, check Customized Thousand Separator in Crystal Report.
You also might want to find some tutorials on the Crystal Reports themselves if you still have trouble.

How to show different icons in Crystal reports depending on the field value?

We are using Crystal Report 12 in one of our projects. Currently I need to create report template which should show different icons based on the some field value.
That field contains a number, storing some kind of status and I have several icons corresponding some statuses.
At the moment I can't figure out how to implement such a thing in Crystal Reports designer.
Could someone please help me?
Showing and hiding graphical objects in CR based on a formula is almost exactly like showing and hiding text labels based on certain criteria.
First, you need to add each icon to your report detail section by choosing the Insert menu, and then select Picture...
Once all your icons are inserted, you will need to edit the suppression formula by right-clicking on each icon and choosing Format Graphic. On the first tab of the Format Editor, you have a Suppress option just like you do for other report objects. Click on the formula button next to Suppress to add a suppression formula to the icon describing when it should be shown or hidden.
I was also searching for the similar solution and this helped me. These steps works.
To display a particular picture, based on a column value, right click on picture> Format Graphic> Suppress (do not check)
And write formula, for example
ColorCode= '110'
(Based on column name ColorCode if column value is '110' I am displaying the picture)

How to calculate sum of a formula field in crystal Reports?

In some inherited code, I see group headers/footers have items like 'Sum of #numcount' . I cannot get the sum of a formula field. Any thoughts?
The only reason that I know of why a formula wouldn't be available to summarize on is if it didn't reference any database fields or whose value wasn't dynamic throughout sections of the report. For example, if you have a formula that returns a constant it won't be available. Or if it only references a field that is set throughout the report and returns a value based on that field, like "if {parameter}=1 then 1" would not be available either.
In general, the formula's value should not be static through the sections of the report you're summarizing over (Though the way Crystal determines this is beyond me and this doesn't seem to be a hard and fast rule)
EDIT: One other reason why a formula wouldn't be available is if you're already using a summary function in that formula. Only one level of summaries at a time!
(Assuming you are looking at the reports in the Crystal Report Designer...)
Your menu options might be a little different depending on the version of Crystal Reports you're using, but you can either:
Make a summary field: Right-click on the desired formula field in your detail section and choose "Insert Summary". Choose "sum" from the drop-down box and verify that the correct account grouping is selected, then click OK. You will then have a simple sum field in your group footer section.
Make a running total field: Click on the "Insert" menu and choose "Running Total Field..."*** Click on the New button and give your new running total field a name. Choose your formula field under "Field to summarize" and choose "sum" under "Type of Summary". Here you can also change when the total is evaluated and reset, leave these at their default if you're wanting a sum on each record. You can also use a formula to determine when a certain field should be counted in the total. (Evaluate: Use Formula)
You Can simply Right Click Formula Fields- > new
Give it a name like TotalCount then Right this code:
if(isnull(sum(count({YOURCOLUMN})))) then
0
else
(sum(count({YOURCOLUMN})))
and Save then Drag and drop TotalCount this field in header/footer.
After you open the "count" bracket you can drop your column there from the above section.See the example in the Picture
You can try like this:
Sum({Tablename.Columnname})
It will work without creating a summarize field in formulae.

Concatenate two fields

I have these two fields in a dataset. How can I concatenate these in Crystal Reports to display next to each other?
select
CAST(T.GLTR_PSTNG_TYPE AS VARCHAR) REF_NO,
CAST(T.GLTR_DOC_CODE AS VARCHAR) GLTR_OUR_DOC_NO
from dom
You will need to create a FORMULA to concatenate these strings.
In the Field Explorer , right click the Formula Fields and select New.
It will prompt you for a Formula Name. Enter the name of your choice, and hit enter.
In the Formula Workshop screen select the 2 fields you require to concat from the Datasource, drag them down to the edit section. The formula should look something like this
{YourDataSource.Field1} & " " & {YourDataSource.Field2}
Click Save and Close.
Now you can drag the Formula Field onto the report to view.