Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple groups in graphs 1

Status
Not open for further replies.

Delboy14

Programmer
Jun 21, 2001
213
GB
I would like to create a stack bar graph which contains the following tables as its data, can anyone explain how to do this. I can create one bar stack graphs OK, but I am having problems creating two bar stack graphs, how should I be grouping the feilds, selecting the graphs etc.

PatientIndex Technique PatientIndex Inhaler
1 1 1 0
2 1 2 0
3 1 3 1
4 1 4 0
etc.........

 
What do you mean by "Two bar stack graphs"?

Do you mean two different stacked bar charts, or a stacked bar chart with Two bars? Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
I mean one stacked bar chart with two bars, thanks.
 
A> What do the two bars represent?
B> What do the bar sections represent?

Group on field A first, and then field B.
Create subtotals at both group levels.
On the data tab do a Group chart, and use the on change of for both fields.
Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
A> The bars represent the state of a sample of patients asthma in relation to their asthma technique and if they take their inhaler.

B> Sections

Bar 1 will show How many patients take their inhalers as instructed, The section above zero will be patients who take their inhaler properly (e.g. Inhaler = 0 above), the section below zero will be those who do not (inhaler =1)

Bar 2 Simillarly will show how many patients have a good inhaler technique. The section above zero those who have a good technique (=1 in the table), and the section below zero will be those who have a bad technique (=0 in the table)
 
Create 2 formulas something like this to use as your group fields:

If Inhaler> 1 then "As Instructed" else "Not"

If technique > 1 then "Good technique" else "Bad"

Using these fields, follow the instructions I gave above.

Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
I have created the two formulas, they work fine. And when I group on the first field it works fine but, when I group on field B it adds the group to one part of field A.

I created the formulas called @Compliance and @Technique,
I grouped on @Compliance which has "Takes Inhaler" or "Forgets Inhaler" as its options.
When I then group on the second field @Technique, it adds the group to "Forgets Inhaler" of @Compliance group.

I can group them seperately and add subtotals fine, however if I try the two groups it seems to mess with group 1. Do you know what I am doing wrong?
 
Compliance Group
if{ComplianceFirstConsult.ForgetPreventer}>0 Then
"Takes Preventer"
Else
"Forgets Preventer";

Technique Group
If{TechniqueFirstConsult.Technique}=0 Then
"Bad Technique"
Else
"Good Technique";
 
If you put these formulas on the detail band, do they all print the correct value for that record?

Keep it on the detail when you add the primary group. Do both values appear somewhere within each group? Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Hi kenhamady,
Can you help me ?
How can i learn wrting furmula in Crystal Reports ?
 
If I only put one group on the details section, the formulas work perfectly, however when I add the second, it is added to a section of the first group and the sub totals, are then incorrect for the first group. Once the second group is added, the first groups values change to one value e.g. all are "Forget Inhaler".
 
The records are Supposed to reorganize to become a subgroup of the main report.

My question is, do the formula values on the detail band match the fields that the formulas are based on (also on the detail band). If not, then you didn't write the formula correctly. If the DO, then the group is correct.

If this doesn't make sense, tell me what the subtotals were before and after adding the second group. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
The values on the detail band do match the correct values from the tables, until you add the second group. (It does not matter what group you try first the same error is occuring)


before adding second group sub totals are:
Forgets Preventer 4
Takes Preventer 4
after adding second group, the subtotal becomes:
Forgets Preventer 8
and the second groups sub totals are OK

 
Lets ignore the subtotals for the moment.

After the second group is added are the formula values on the DETAIL band, no longer matching the fields these formulas are drawn from (also on the detail band)? Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
sorry the problem occurs when I had the data in two database tables e.g. Forget Inhaler and Inhaler Technique.

I think, the patient indexes were being linked from both tables.
I have put them into on table e.g.
PatientIndex ForgetInhaler Inhaler Technique

and I can now get one stack bar graph with two bars and sections in each, it is nearly correct as well. thanks for your help sorry, it must have been frustrating
 
The only problem left is that, the subtotals are slightly wrong. I want the subtotals to be on ForgetInhaler and Inhaler Technique Seperately.
But they are combining the feilds to count those who forget their inhaler and have a good techniuqe, forget inhaler & Bad Technique , Takes Inhaler & Good Technique etc.

Is there a way to subtotal both groups but not with each other?
 
If you have two group levels, and two options at each level, you get 4 subgroups, two in each group.

So you should get 2 different subtotals in GF1 and 4 different subtotals at GF2. These 4 subtotals are what you want for your chart.

Tell me what these actual numbers are on your report, and what you want them to be instead, and then tell me why. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Technique, ForgetInhaler.
The subtotals for ForgetInhaler (GF1) are 4 Forget Inhaler
4 Takes Inhaler
The subtotals for (GF2) Technique are:
1 with Takes Inhaler and Good Technique
3 with Takes Inhaler and Bad Technique
4 with Forgets Inhaler and Good Technique

The subtotals that I would like are:

I would like ForgetInhaler as 4 Forget Inhaler
4 Takes Inhaler
And Technique Subtotals as 7 Good Technique
1 Bad Technique

The reason I would like this, is the first bar of my graph should show how many patients take and forget to take their inhaler.
The second bar should show how many patient have a good inhaler technique and how many have a bad technique.

So I want the values side by side, but I dont think that I want the subtotals to be linked from both groups in (GF2)


 
So you want 2 bars, side by side, but sliced based on different criteria. You can't do this in one chart. You will need two charts, but you can put them side by side.

Will the two bars allways include the same number of people, the number of subjects in the report. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top