How to sort MS Access report by group pages - sorting

I have a grouped report.
Whenever a new group starts, I set 'Me.Page' to 1.
The number of pages for each group, I am storing in a table in the 'PageFooter_Format' event.
How can I sort the groups by their number of pages?

I would say you can't as the grouping takes place before formatting the report.
Perhaps in a multi-step: First run the report and retrieve and save the group ids and page counts, then close the report, adjust the source to hold the page counts to order by, change the report grouping/sorting to respect this sequence, and run the report.

Related

Can I use a list to repeat two tablixes on a report page?

See image below. Warehouse and Customer are dropdown lists populated via query. Year is a text field. The two tables display data from datasets driven by the report parameters. Is there a way to repeat the two tables based on each member of the Customer dropdown? Preferbly with a pagebreak after the 2nd table.
I normally do this using subreports. You could either create a single subreport that contains both tables or individual subreports. The individual approach might help with page breaks etc so that's the way I'd go.
Step 1: Create a report for your first table.
As you don't state what each table does, I'll make some up for the sake of illustration.
The key is to create a subreport that displays just the info you need in a single table. So in your case this might mean we only need to pass in a single parameter, CustomerID. You might need to pass in more such as Warehouse but I don't know...
In my made up scenario, let's assume the report shows customer contacts so we create a subreport (let's call it subCustomerConacts). It has a single parameter pCustomerID and a single dataset dsCustomerContacts. The query might looks something like SELECT * FROM CustomerContacts WHERE CustomerID = #pCustomerID. Add whatever tables/textbox etc you need to display your data.
Test this subreport works by manually typing in a CustomerID
Step 2: Create a report for your second table.
Do exactly the same again, creating a new subreport. Let call this subCustomerOrders. Repeat as above until you end up with another report that can display order details (or whatever you need).
Finally, create you main report.
This is basically what you have described in you question in terms of parameters etc.
Now to add this bit that will call you subreports.
Create a dataset (let's call it dsCustomerLoop) that contains each customer from your parameter something like SELECT DISTINCT CustomerID FROM myCustomers WHERE CustomerID IN (#myCustomerParameter)
Add a table to your report, 1 column wide and stretch it so it's wide enough to accommodate you subreports.
Set the dataset to point to dsCustomerLoop
Right-Click the cell in the detail row and do "Insert Row -> Inside Group - Below". You should not have two detail rows.
Next, right click the top detail row and do "Insert -> Subreport"
Right-Click the newly inserted subreport control and choose "properties".
Choose your first SubReport form the drop-down list
Click parameters on the left,
Click "Add" and select the CusomterID parmeter, set it's value to the CustomerID field.
Repeat this process on the seconds row, choosing your seconds subreport.
You may want to also add a 3rd row to the table, you could insert a rectangle into this with page breaks set to force a new page after each seconds subreport.
That's It. When the report runs it will produce two rows per customer, each row containing a subreport.
I hope this is clear enough, I've rushed through it a bit but if anything is unclear, let me know and I'll provide a clearer solution.

Crystal report summary depending on another column

Image:
Hi, i am new to crystal reports but a fast learner.
I need to make a report, that shows the price of specific maintenance during a month.
The important thing is that the Total values are correct
As you see the "arbejdsordre" can appear multiple times because on the same column it has different "titel" the different "titel" has different "planlagt tid" but the same "Omkostninger"
I need to tell crystal report to only calculate "omkostninger" for "arbejdsordre" one time when "arbejdsordre appears several times.
how can i do this?
Best regards
André
If you go into the Group Expert and then group your report data by Omkostninger you should be able to accomplish your goal.
Display the value for "Omkostninger" in the Group Header, and then display the different "titel" and "planlagt tid" in the details section or any other group header section that is a lower level grouping than Omkostninger.
This will allow you to display each unique value for Omkostninger once and only once on the report, with all of the other data for each Omkostninger value displayed in the details.

SSRS Finding Percentage of Group vs Total

I created a table in visual studio showing case numbers listed per judge (grouped by judge) and now I need to create a summary table of that data. I have the total case count per judge but I need to determine the percentage of cases that each judge has. I found this article:
SSRS percentage of a total
but the answer discusses grouping by dataset, whereas I am working with row groups within the report and I haven't been able to find anything that speaks to that.
I tried just replacing the dataset name with the group names for each:
=sum(countdistinct(Fields!case_num.Value),"judge_group")/
sum(countdistinct(Fields!case_num.Value), "case_num")
also tried:
=sum(countdistinct(Fields!case_num.Value,"judge_group"))/
sum(countdistinct(Fields!case_num.Value, "case_num"))
I also tried using just one group, the overall group "case_num" and I received an error message that my scope param is not valid for an aggregate function.

How To Sort Specific Column Data in SSRS Tablix

I am using Visual Studio 2012 for SSRS and my queries come from using Microsoft SQL Server 2012.
My question below pertains to SSRS and sorting.
In my Tablix, I currently have the Row Groups set up as Group -> Manager -> Owner -> Status Description and when it pulls the data from the data from the dataset, it pulls in fine. In the tablix, basically everything is a drilldown and each of the Row Groups (except Group) is hidden initially and can be displayed/toggled by the report item ahead of it. In the Status Description part, when it pulls in the records, it pulls them in as Active, Completed, In Process...which is fine because they are pulling in ABC Order.
But I want to show that specific column when it pulls in as Active, In Process, Completed...in the way that a specific file would go through the process. These are only 3 specific ways the data could pull it as, there are more, but these are the most common seen. How do I sort that individual column to get it in the way I mentioned above or a way that I can customize the sorting based on how I want it to be seen?
You can use expressions in the sort order to get the sorting exactly as you'd like.
What you can do is use the SWITCH statement to number your output in the order you want. For example I have 3 statuses: "Complete", "On Hold" and "Word at Risk". Normally they would either sort as Ascending or Descending... but if I enter this in the Sort Order Formula I can change that:
=SWITCH(
Fields!PRS_STATUS.Value = "Complete", 1,
Fields!PRS_STATUS.Value = "Word at Risk", 2 ,
Fields!PRS_STATUS.Value = "On Hold", 3)
And now it orders 1,2,3 aka Complete, Work at Risk, On Hold.
You can put this switch in a larger switch statement to have multiple sort orders depending on a criteria or parameter.

How to create non filtered summary in a filtered report in crystal reports

Pretty new to CR
I have a grouped survey report filtered by a parameter so (of course) all the summary's in the report are being filtered by the parameter.
I need a "average" summary on a group (question) that is not filtered by the parameter.
Not sure on how to go about this.
Thanks
There are many options to tackle this problem, but the one that will require the fewest changes to your report will be if you use a SQL Expression (basically a subquery) to get that unfiltered average.
Let's say that you're grouping your report by {table.group} and looking for the average of {table.number}. You could create an expression like:
case when "table"."group" is null then null
else (select average(number)
from table
where group="table"."group")
end
Note that the double-quoted fields refer back to the main query, so you're effectively correlating the average per group back to each row from the main report which can then be used in the Group Footer or Group Header.

Resources