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

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)

Related

How to suppress Details section based on value in database field

I am trying to make a report suppression of Detail B segment based on a value from a database field.
I tried to set the variable and suppress based on value of variable but it only shows for one Detail B. Maybe increment of value is not working?
Current state:
https://imgur.com/a/5bkAFle
Expected output will be that if database field will be 6 that section Detail b will appear six times in report.
Expected state:
https://imgur.com/a/fozburX
I am totally new in Crystal Reports so I prefer a simple solution.
Thank you very much.
Right click on Section and go to Section Expert and write the suppress formula by clicking the button on right side of Suppress option.

About using supress blank field in crystal report

I am developing software with c# and I create crystal report that get data from datagridview and show it
the problem is that I have three field in datatable but when field is empty it lefts empty space. I want to fit the field to other when empty, like this:
and when show up in report like this
I want to supress the blank field and my report designer
thank you so much for reading and answering ..
this is how look my report designer .
and i have two diffrent type of report look like this
and the other .
Put you ExParameter into separate section (you can have multiple sections from same logical part of report) and use suppress condition for entire section (or just check 'suppress blank section' in section expert).
In addition, you should group by Analyse and put Analyse value into group header - this way you won't duplicate this part of report either.
Right click on this field, click on Format Field, click on Common tab and then Check the Suppress If Duplicate

Border around blank data in Crystal Reports

I'm currently creating a report in Crystal Reports and each item has a border. The problem is that some of the fields can have a NULL value. When a field has a value of NULL the border doesn't show up, leaving an unsightly gap in the data.
The only solution I was able to come up with is that I create a formula for each column that displays the value if it's not null or displays a blank space when it's not null to trick crystal into thinking there is a value. This would be a major pain and definitely be confusing to anyone trying to modify the report. Is there a better solution to this problem that I might have missed?
Note: I'm unable to modify the SQL.
You can change the report options to give the default value to the null fields. But it may be not desirable for other cases.
If you wanna try it, right click the report and select "report options". Check the options "convert database null values to default" and/or "convert other null values to default".
You can insert a textbox on the report, then place the field inside that textbox. The borders would be placed on the textbox and would always appear regardless of the field value.
A few drawbacks to this,
Formatting cannot be done on the field any more (e.g. if you needed to display 123 as $123.00 you'd need to create a formula to perform the formatting then insert that formula into the textbox)
Export the data to Excel would not respect the data type - any numbers would come over formatted as text (though displayed exactly as you formatted them on the report) with that little green arrow in the cell
I found that method from https://archive.sap.com/discussions/message/9923668#9923668

Suppressing empty fields in crosstab

Suppressing lines in a cross tab crystal report
We currently have a cross tab report having a summary with 4 fields placed in a single section, sequentially one below the other.
If one of the fields are blank for e.g. 4 fields are named as f1, f2, f3, and f4 if f2 is blank we need to suppress this section to displaying a total of 3 lines.
I.e. displaying fields f1, f3, f4.
Is this possible in crystal reports 10.0. This would save the display space of the report also present a consistent look to the report.
Please refer to the attached image which may help understand the problem.
Please see this for further details
I solved this by!
Go to Cross Tab Expert and ,Customize Style And select desired row and then check Suppress SubTotals in group options.
IF I understand your question,
If you are using the built-in Cross-Tab object, then rows/columns will drop automatically if there is no data to populate a full row or column. This is standard behaviour of the object.
If you are mimicking a cross-tab using groups or rows, you can conditionally suppress either group or row based on a formula. This can be done in the Section Expert using the option Suppress (No Drill-down) by clicking on the "formula" symbol.
If I misunderstand, then please explain again.

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.