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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

910 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

21 Experts available now in Live!

Get 1:1 Help Now