Crystal Reports Group Header with Formula Field - crystal-reports

So I made a Crystal Report with some custom Group headers(ie. Created a formula field based off database data then used it in a group header). The Formula specifically that seems to be giving me trouble is:
IF {Quote.Field1} = true THEN "Incremental Sales Assist"
ELSE IF {Quote.Field2} = "Yes" THEN "Fulfillment"
ELSE "Sales Assist"
When the report generates it appears to ignore the else.
If you expand the tree where the arrow is with no text next to it, it does provide the correct data that should be grouped with "Sales Assists" I just don't understand why the text is not showing there...Has anyone else encountered anything like this? Is it a crystal bug or can I just not do this? Any assistance is greatly appreciated.

I had the same issue as the above and was getting a blank value for the last output of the IF statement.
I resolved it by recreating the Formula Field as a SQL Expression Field then using that as my grouping field.

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.

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

Crystal Reports - sum of report field error when inserted into report

I've created a crystal report with a field issueSUM.LineTL in the detail section of the report.
This field returns the correct information per line.
I need to sum this field in the report footer and i have created a formula field - Sum({IssueSum.LineTL}).
I inserted this field and at report generation it comes up with an error:
Error in formula Sum({IssueSum.LineTL})
The field name is not known
Please advise as to what could cause this
Many thanks
You have given wrong syntax in sum forumla, instead of creating a formula and writing the sum(). Right click on issueSUM.LineTL and go to insert summary and generate summary from there.
I'm not sure if it is just a typo here in your post, but your formula is Sum({IssueSum.LineTL}) whereas your field is issueSUM.LineTL. That's a capital 'I' versus a lower-case 'i'. When creating formulas, double-clicking on the field in the field explorer window of the formula editor to insert a field will help you avoid such typos.
Other than that I agree with #Siva that right-clicking and choosing "Insert" -> "Summary" is a much easier and more reliable way to create summaries. Make sure to choose "Sum" as the type of summary from the choices available and put the summary in the report footer.

All fields are not showing for Group and Sort Section

I have a report created in Crystal Report 7.
I have modified a view on which the report depends.
When I clicked Verify Database new fields are added in Field's list.
After modification of View now I need to change the Grouping Order of report. When I searched in Fields Explorer there were all the fields present, but in Group Box those fields are not coming. Am I missing something, please help.
Also In Visual Linking Expert tab Browse Field is disable and for rest are enable.
I have never worked with CR 7 but I suspect a field type/size/characteristics issue. Can you put these 'missing' fields in your detail section and have a look at the displayed values? If these look normal, what I would try are the following:
convert the missing fields into 'smaller' ones, by setting them in
the query the following way, just to check if the problem is linked to a field size
issue or something like that.
CONVERT(varchar(10), returnReason) as returnReason
Another try would be to create the grouping fields in the report, adding corresponding Formula Fields like
groupReturnreason = left(returnReason, 10)
No guarantee of course, just a trial.

Formula for Suppressing Field if duplicate in Crystal Reports

I have a view which shows data on crystal reports where I have fields like tariff,rental,shares,gross and net.My problem is if someone changes the tariff in database it would show 2 rows of the same record with different tariff which is normal behavior from database point of view but I want to suppress the field of monthly rental to 0 if the same id has different tariff or the rental is repeated in new record.
ID Tariff Rental
1 20 390
1 15 390
I want the field of Rental on reports to be suppressed if duplicates based on id.Currently I have used this formula in crystal report to check previous field data and suppress if duplicate.
{DatabaseField}=Previous({DatabaseField})
It is working fine but if the id is not same and the rental is repeated then also it will suppress which I don't want.I want it to suppress only for same id.
You have to write the formula into field suppress. (No need on suppress if duplicated)
On Rental Field
{ID} = previous({ID}) and {rental} = previous({rental})
If ID and Rental are same then only the Report will suppress Rental.
I guess this will work for you.
In Crystal Reports, right-click on the Details section and select Section Expert.
In the Section Expert dialog box, select the X + 2 button beside the Suppress command. The check box must remain unselected for this formula to work.
In the Formula Editor dialog box, create a conditional formula containing the Next function to evaluate the records for duplicate values and to suppress the Details line
example:
{Table.Databasefield}=Previous({Table.Databasefield})
I had to make a slight change to the formula in the solution by Janarthanan by adding parenthesis to make it work with Crystal XI.
I used:
{ID}=previous({ID}) and {rental}=previous({rental})
this formatting variation, which is presented in the edited question, helped me to solve a similar problem.
Put this in suppress formula of field to hide.
if {myTable.ID} = previous({myTable.ID}) then
true
else
false