[Last Call] Learn how to a build a cloud-first strategyRegister Now


Crystal Reports problem

Posted on 1998-12-21
Medium Priority
Last Modified: 2010-05-03
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
Question by:Jagar
  • 3
  • 2
LVL 18

Accepted Solution

mdougan earned 600 total points
ID: 1451797
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!



Author Comment

ID: 1451798
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.
LVL 18

Expert Comment

ID: 1451799
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.



Author Comment

ID: 1451800
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).

Author Comment

ID: 1451801
Thank You

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


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question