Crystal Reports problem

Hello everybody I have the following report that I have to create, but I don't know how I would go about doing it within Crystal.

What I want to do is display the seq_no and quest_text from a table called audit_detail on the left hand column.  This will go in order seq_no 1 through whatever and the corresponding text.  It is kinda difficult to explain with words  what I want on the right hand side, but I'll show you an example.

Left Side                           Right Side
1 Authorized POG Dealer             1  89.3%
                                    2  10.7%

2 # of clipstrips                   0  90.7%
                                    1  5.3%
                                    2  4.0%


Know what the above shows is how many people answered question 1 with a response of 1, 2 in the first question and 0, 1, 2 in the second question.  This information is display in the answer_detl table in a field called answer there is also a seq_no in this table which links back to the original table.  There is one more table called answer_header which contain a field called survey_code (there is also a survey_code in the orginal table that is linked to this).  This table is linked to answer_detl by a field called answer_key.  

I do not know how to go about listing each answer that was given for each question and the finding the total percent
Who is Participating?
mdouganConnect With a Mentor Commented:
This is not a simple question to answer but here goes:

When you create the report with the standard report wizard, you'll want to make sure to group by seq_no.  Hide the Group header for this group and hide the detail line as well.  So, all you are showing is the Group Footer for the seq_no group.  In that footer you can list the percentages for each answer using calculated fields.  The calculated fields will have formulas that count the number of detail lines with each type of response and divide by a count of the total detail lines.

Now, if the number of possible respones vary for each question, and you want to do all of this dynamically, then you'll have to get fancy with the query that you use to populate the report.  Namely, you'll want to do all of your summation in the query.  Let me know if you have no idea of what all of this means!


JagarAuthor Commented:
I have sum idea what it mean, but am not really clear on how to do it.  If you could provide an example that would be great, but your right what you says makes since and should probably come close to working.  If you could provide the example that would be great.
OK, lets say that you create a query that joins the audit_detail table and the answer_detl table on seq_no.  The result would look like:

seq_no  quest_text                       answer_no  answer_key
1       Authorized POG Dealer            1          555
1       Authorized POG Dealer            1          324
1       Authorized POG Dealer            2          123
2       # of clipstrips                  0          442
2       # of clipstrips                  0          211    
2       # of clipstrips                  1          776    
2       # of clipstrips                  2          343

When you run the report wizard, tell it to group by seq_no so that the records will break inbetween seq_no 1 and seq_no 2, to give you a place to show your totals.  Again, hide the group header and the detail line.  In the footer place a few calculated fields.  

For example, you could create one calculated field called TotalResponses whose formula would look something like:

To count each response you could have three calculated fields for each possible response:

CheckAnswer1 - if {answer_no} = 1 then 1 else 0
SumAnswer1   - sum(CheckAnswer1)
Answer1Pct   - if TotalResponses > 0 then

The only fields you would actually show on your Group Footer would be Answer1Pct and TotalResponses.  You would have to create "Answer1"-like calculated fields for the largest number of possible answers.  So, if you have one question with 5 answers, then you'll need to create Answer1-Answer5 calculated fields.  You can check the property for these to be "blank if zero", so, if a question has less than 5 answers, say 3 answers, then answers 4 & 5 will be zero (because no one could have given those answers).  So, they will not print.

This is just one approach to your report, and not a very dynamic one at that.  Again, there may be other, better, ways to do it but hopefully, this will point you in the right direction.  Unfortunately, it's about all I can do in this forum, since I can't look over your shoulder as you work with Crystal.


JagarAuthor Commented:
I started to play with these ideas and have made some progress.  I play with these additional ideas.  I will give you the points, but I'm going to try and finish the report first, so that maybe you can provide additional help (hopefully won't need any).
JagarAuthor Commented:
Thank You

You led me in the right direction and I used something a little different, but along the same ideas.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.