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

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.

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

Crystal Reports Group Header with Formula Field

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.

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.

Suppress Crystal Reports section if there are no rows in a datatable

I have a section in a Crystal Report that I want to suppress. I need to suppress it if there are 0 rows in a particular table in the dataset I am using. How would I do this? The Record Number special field provided appears to be an internal count of records in the report, and does not relate to the rows in the underlying data table.
I am creating the report from C#, but I cannot suppress the section from the code (it doesn't fit the project structure) - I must be able to do it from the report itself. The table concerned is definitely being passed to the report in the dataset, but it contains 0 rows. There must be a way to establish this inside the report itself.....
Can anyone please point me in the right direction?
In the Crystal Reports designer, view the properties of your section and there should be an option to Suppress, which you can give it a formula to return the appropriate boolean value.
You could then use the Count() function within that formula and (I believe) you can pass the name of your dataset to the Count() function to get the number of rows in that dataset.
I did the same thing on a complex report about 3 months ago but I don't have access to the report any more having changed jobs so I'm sorry I cannot be more specific, but hoepfully this gives you a starting point.
Just had a quick Google - try this.
If the section does only contain database fields and f.e. no text fields, then you could use the setting "Suppress Blank Section" in the "Section Export" (rightclick section) for that section.
As an alternative you could use the following formula in the "Suppress" in the "Section Export" for that section:
IsNull({table.field})
"{table.field}" is one of the fields in the dataset.
Hope this helps.
Go to "Section Expert" and click "Supress (No Drill-Down)" and try adding this:
IF {"DragYourFieldHere"} = "" then true else false
Create one dummy group,check on its header for each page,add the header in the group header of the dummy group.