I have a sales report grouped by city and country. I need to change the order, some times the groups will be sorted by the total of sales and another times will be sorted by name (alphabetic). How can I do it? I'm using VS2013 C# and the tools of Crystal Reports.
You need to create a formula with if else conditions and use the formula to create a group....
Best approach would be create a parameter and depending on the parameter selection write if else and use the formula in group expert
Related
I'm using C# and Entity Framework.
I created the dataset to display data from it:
With only one table(buildings), i created my crystal report very well.
But now, i want to create another one that display:
name_b, Adresse_b,date
the number of appartements of a building
the number of shared_areas of a building
and the name of the user.
I have to write a query in the crystalReportViewer1_Load and set it as datasource or what?
Thank you to help me.
There are a few options -
1. In your current report, group the report by Building, then
create a sub-report containing all of the details (name,
address,etc) and place it into the group footer in the main (outer)
report. Link the report by ID_Building. This will show you all of
the details for each building.
2. In you current report, add all of the tables to the data connection (database expert); then group the report as desired (by building, Apartment, etc).
You can create running totals to get the count of apartments and the number of shared_areas.
I am making a report that has several groups. Each group represents an object, and in each group the details for the object is listed in a DetailBand.
However, I can not find a way to sort the groups so that they are ordered on the report based on the name of the of the objects. I have read documentation from DevExpress that explains how to sort groups by summary functions, and how to sort within a DetailBand, but this is not helpful for my situation.
The (very) basic structure of my report is like this:
Report
DetailReportBand
GroupHeaderBand (want to order by this)
DetailBand
Any help is appreciated :)
Edit: I am doing this in code.
Using the Group and Sort option you have to first add the field you wish to group by as a sort on the report and then tick the option Show Header, this will automatically create the group header for you and sort via that group.
If you have already created the group header band you can just copy and paste the fields into the new band and then delete the existing group header band.
I have been fighting this same battle today. I've found that in my case I had to set the SortingSummary.FieldName property to the name of the field to sort on, which in my case is different than the name of the field I'm grouping on.
The name of my GroupHeaderBand is QuestionsGroup. I am grouping on a field called "GroupName", but I want the groups sorted by "LineNumber". In code, I have this:
QuestionsGroup.SortingSummary.FieldName = "LineNumber";
GroupFields.Add(new GroupField("GroupName"));
Also, make sure that the GroupHeaderBand.SortingSummary.Enabled = true. I had previously set the Function to Custom, and that was not working so I arbitrarily changed it to Avg and now it's working.
Good Luck!
I create a formula "class_section": {Monthlyfeemaster.Class} & {Monthlyfeemaster.Section}
then create a formula
sum_tuition_class_section: sum({Monthlyfeemaster.Tuition Fee}, {#class_section})
it is giving an error:" there must be group that matches this field"
That's because it thinks you're summing all tuition fees in one class_section. class_section is not one of your groups. Do
sum({#class_section}, {Monthlyfeemaster.GroupFieldName})
This will add up all class_sections per group.
Class and section sound like strings though. Do you mean to sum all tuition fees per class_section. If so, your code is right but you have to create a class_section group somewhere on your report.
I have a table Called EmployeeTypes which hold types of Employees, now i want to create a report using SSRS which will have something like this:
EmployeeType1 EmployeeType2 EmployeeType3
4 23 2
where the numbers are the count of employees.
problem is how can i generate the columns programmatically like that as the EmployeeTypes Table can have many Types and expand by time?
It sounds like you are looking for a cross tab report, using a data set like select count(*), employee_type from employee_table group by employee_type.
You can use the report wizard to create a 'Matrix' report type (as opposed to a 'Tabular' report type). The wizard will guide you through the steps to get what you need.
An SSRS report is defined by an XML file (the .RDL or .RDLC file). You could generate columns programmatically by directly modifying the XML. Not for the faint of heart, but people do it, and it can be done.
Here is a sample:
http://www.codeproject.com/Articles/11254/SQL-Reporting-Services-with-Dynamic-Column-Reports
I have a C# program with output that looks like this (unexpanded rows):
and this (expanded rows):
Here's my SQL for the Fill method:
SELECT MBRSEP, LOCATION, BILLMOYR, RATE
FROM CAR1.CAV_MBRHISTDETL
WHERE (BILLMOYR IN ('1104', '1105', '1106', '1107', '1108', '1109')) AND (RATE = '0096')
ORDER BY BILLMOYR ASC, MBRSEP ASC
What this report is showing is a breakdown of customers with a rate type of 0096 for the months of April, May, June, July, August, and September.
What I'd like to see is a unique count for each distinct customer (MBRSEP) (a grand total of unique customers for those months), but I can't get my head around how to do this. Can anyone help or point me in the right direction? This little program was written with Visual Studio 2010 using a blank form, a databound dataset, and a reportviewer control.
EDIT: Also, here is the report source on the report design screen:
On the designer screen, I'm assuming there's some way to add a field that will show total number of unique values in a certain field in the report, but I'm not sure how to do that. (NOTE: I just added the SQL statements in a text field on the report for clarity)
Have you tried the SSRS CountDistinct function?
If I read this correctly, you want to find how many customers you had:
SELECT count(distinct MBRSEP) TotalCustomers
FROM CAR1.CAV_MBRHISTDETL
WHERE (BILLMOYR IN ('1104', '1105', '1106', '1107', '1108', '1109')) AND (RATE = '0096')
ORDER BY BILLMOYR ASC, MBRSEP ASC