Crystal Reports problem

Posted on 1998-12-21
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 150 total points
Comment Utility
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

Comment Utility
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

Comment Utility
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

Comment Utility
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

Comment Utility
Thank You

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


Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now