0
votes

Not sure how to approach grouping a report that can group things differently depending on condtions. Here's the scenario. I have companies, policy numbers and products. Sometimes a policy can cover more than one company, but sometimes a single company can have more than one policy.

So in the first case where a policy covers more than one company it would look like this:

Policy > Company > Product

In the other case where a company can have multiple policies it would look like this:

Company > Policy > Product

Any ideas of how to approach this?

2
Would there always be 3 levels of grouping?craig
Yes, a policy might cover more than one company, but if that is the case then a company would not also have multiple policies with in it so it is always either policy > company > product or company > policy > product. Basically how it works is that small companies are often grouped together and covered under one policy, whereas a large company might be split up to be covered by more than one policy.Louise Eggleton

2 Answers

2
votes
  • Create a parameter to allow a person to choose one of the two paths
  • Create 2 formula fields that use the parameter field to choose between the database fields:
// {@level_1}
Select {?grouping}
Case "Policy > Company > Product": {table.policy}
Case "Company > Policy > Product": {table.company}
Default: {table.policy} 

// {@level_2}
Select {?grouping}
Case "Policy > Company > Product": {table.company}
Case "Company > Policy > Product": {table.policy}
Default: {table.company} 
  • Create a group for each formula field and one for the product field
0
votes

Actually, there are two ways to show the data into categorised groups, Say in example For the first case where a policy covers more than one company

Policy > Company > Product

You Can either get count(*) records obtained i.e. no. of companies more than one under several policies you can create a formula and based on which a group can be inserted into the design view.

Another Way is to split the details section and on the basis of requirement suppress the unwanted section via conditions(x2 button).

Similar approach is also possible by using sub-report but is a bit complex task but works for both scenarios.