Crystal Reports Dynamically Grouping by Date - crystal-reports

I'm relatively new to Crystal Reports and it seems like this should be easy, but I haven't been able to figure it out after a lot of googling. I'm working on a report in Crystal Reports XI that will show total hours logged by support staff for a date range and show sub totals by week, month, or both depending on the user input. My report is currently arranged as follows:
Group 1 Header - Support Staff Member
Group 2 Header - Ticket Closed Date with section printed monthly
Group 3 Header - Ticket Closed Date with section printed weekly
Group 4 Header - Ticket Category
Group 4 Footer - Sum of time logged in each category for the week
Group 3 Footer - Sum of time logged in all categories for the week
Group 2 Footer - Sum of time logged in all categories for the month
Group 1 Footer - Sum of all time logged
My original idea was just to suppress the header and footer for groups 2 and 3 when they weren't needed, but if I manually do that it still prints the records by week and month. Is there a way to not have the grouping at all unless the parameter says to show those totals? Or if that isn't an option, how would I use the parameter to change whether the group prints records weekly or monthly?
Thank you

Best option would be create a string parameter 'option' with values weekly and monthly.
Now create a formula grouping.
If ?parameter='weekly'
Then //your weekly code here
Else if ?parameter='monthly'
Then //your monthly code
Now use this formula in grouping instead of multiple groups.
Now when user selects option your grouping will change dynamically.
Hope this helps

Related

How can I deselect an entire group based on the value of one member of the group?

We have customers that order product on an annual basis. I have a report that needs to show only customers and related orders that have NOT placed an order in the current year. I filter all orders down to the current year and the year prior.
Right now, if a customer has orders for last year, I want them to show on the report, but once the customer places an order for the current year, I want both the current year order and the prior year orders to drop off the report.
Our salespeople use this report to manage the customers that need to be contacted in the current year. Once the report is empty, they are done for the year.
I know how to suppress the rows based on the value of a single member of the group, but suppressing them does not remove them from the summary calculations, so I need them to either disappear, or I need to be able to change all values to zero for that customer once they place a new order.
Thank You.
I created a running total field to trap the current year.
If Year(#Date)=2019 then 0 else Qty
When I put the formula into a qty formula, I get the "Summary has been specified for a non-recurring field"

Crystal reports - Can't filter on custom formula number field

Crystal reports don't let me use a custom count formula field to filter which transactions to show in a manager report.
I'm creating a Crystal report that team leaders are supposed to take out to see on how many occasions their employees have reported in sick. A record is only supposed to show if that person has reported in sick 6 or more times the last 12 months.
The report shows a record (a page) for each employee belonging to the managers organisational unit. Below the employee information is a subreport where I show the transactions from the salary/time system. Using select expert, I have filtered out the transactions that is supposed to show. I have then created a database field that count which day was 12 months back from today, and filtered so that only the transactions falling into this period shows.
My last problem is that I only want to show the record that has a minimum of 6 such transactions during the period. I created a formula field named #Antal ("amount" in Swedish) that simply counts the distinct number of dates in the "from"-date for the salary transactions I'm showing (since a change of law 2019-01-01 we needed to create a new transaction type, so some of the occasions after 2019 may have two transactions referring to one sick leave, thus I'm counting the first day of the period instead), DistinctCount ({P_LSTAT.P_SXXX06})
Now, the subreport has a new column with Antal (amount) that counts the amount of the desired salary transaction. I then try to use the selection formula to only show records where {#Antal} >= 6 but I get the following error:
This formula cannot be used because it must be evaluated later
Is there any other (better) way of doing this, or am I simply missing something?
For your selection based on {#Antal} >= 6 you need to use the group selection formula, not the record selection formula. Record selection is used to select records which meet the criteria before reading in the data. Group selection is used to filter out entire groups of records based on summarised values, after the records have been read in and the summaries calculated - which sounds like exactly what you need here.
The value of a Formula Field is out of scope when the Select Expert is evaluated.
There is no process for calculating the value of a Formula Field before it is printed within the section of the report it is placed. The Select Expert is evaluated prior to any section of the report being printed, so at this time all Formula Fields are effectively Nothing.

Crystal Reports 11 - New page after each parameter

I am running Crystal Reports 11 and I have a report that has 7 subreports that it pulls and when done, is multiple pages long. I have three parameters I ask for. I want to change one of the parameters to allow multiple fields so I don't have to keep refreshing it but I want the report to repeat for each field value I add.
Example, the report asks for month. I want to put in January, February and March into the field value. The report then should run for each of those months and give me one large report where January and all January data is back to back and then goes to February, etc.
Is this possible?
Thanks.
Jayson
Group the report at level one by Month.
In the Group Options tab (or in the GF1 section), turn on the 'New Page After' option.

How to display a full set of group headers in Crystal reports?

I have tricky question regarding Crystal reports. I have a data source that is basically like
DateGroupKey | Shop name | etc.
DateGroupKey =1 is this month, =2 is the previous month, =3 is the month before the previous. The trick is, every shop is only once in this list, in the most recent month, that had some activity. It is done with some sql magic, not the point of the question.
The report has two levels the top level looks like this:
This month (number of entries)
Previous month (number of entries)
Month before previous (number of entries)
No activity in the last 3 months (number of entries)
It has a #monthname variable that has a formula like:
IF ISNULL({GetOrders.DateGroupKey}) THEN "No activity in the last 3 months"
ELSE IF {GetOrders.DateGroupKey}=0 THEN "This month"
ELSE IF {GetOrders.DateGroupKey}=1 THEN "Previous month "
ELSE IF {GetOrders.DateGroupKey}=2 THEN "Month before previous "
The ground level looks like a list. If you double click on the 'This month' it will show only those records. This is well and good so far.
Now the question, if there are no entries for example with the DateGroupKey 1 there will be no group header 'Previous month'. I would like to have a group header displayed (even with 0 entries). How can I do that?
Thank you for your help!
Sziro
Edit: picture of the design:
This is a tricky one. If there is no data for a particular scenario, then CR doesn't know that there actually is a group. What you will have to do is create a dummy table that has one column that lists all your possible groups. You will have to add that to your report and then outer-join your real data table to the dummy table. That should give you all your data with a group for each one even if there is no data for a group.

How do I order groups alphabetically?

It may be a bit more complicated then that, but here goes.
This report lists overtime on a weekly basis. Each driver has worksheets that outline details of a given shift. The user selects a period of a week, and I have some formulas that fill variables with their hours worked for each day of the week. The lines look something like this:
CKL09844 - LATTA Scott 9.5 8.6 10.5 11 0 hourlysum, etc.
The records are grouped by the 'Driver ID' - the first field - but I'd like to have them listed in alphabetical order. Only the group footers are being displayed currently. Anyone have any advice?
Edit: List them alphabetically by last name, that is.
You can either
Change the group to the 'LastName, FirstName' field or fields instead of driverID or
Use a summary to sort the group. You can do this by inserting a summary like maximum({table.name},{table.driverID}) and placing it in the footer and then suppressing it (It's stupid but Crystal needs this field actually in the report before it will allow you to access the next step). Then, go to "Report -> Group Sort Expert -> For this group sort: All" and select the summary you just made.