Solved

DataReport Grouping

Posted on 2001-06-12
11
577 Views
Last Modified: 2012-06-27
I'm using the datareport by assigning a recordset progamatically. If I have a recordset that has 7 (daily)revenue amounts for each store location, can I group these with a subtotal using the group header/footer? This is what I have:

City1   Monday    $200
City1   Tuesday   $100
City1   Wednsday  $300
City1   Thursday  $200
City1   Friday    $100
City1   Saturday  $400
City1   Sunday    $200
City2   Monday    $300
City2   Tuesday   $100
etc...

What I want:

        City1
City1   Monday    $200
City1   Tuesday   $100
City1   Wednsday  $300
City1   Thursday  $200
City1   Friday    $100
City1   Saturday  $400
City1   Sunday    $200
     City1 Total $1500

        City2
City2   Monday    $200
City2   Tuesday   $100
City2   Wednsday  $300
City2   Thursday  $200
City2   Friday    $100
City2   Saturday  $400
City2   Sunday    $200
     City2 Total $1500
etc...


Can I Assign a recordset and do this or do I have to use the DataEnvironmet?

0
Comment
Question by:wd3
11 Comments
 
LVL 12

Expert Comment

by:DRRYAN3
Comment Utility
Use the group footer and insert the formula =sum(fieldname) to total your dollar values.  Group on your city name field.
0
 

Author Comment

by:wd3
Comment Utility
I keep getting Datareport does not match sections.
0
 
LVL 12

Expert Comment

by:DRRYAN3
Comment Utility
Are you trying to build the datareport in code or are you using the designer?
0
 

Author Comment

by:wd3
Comment Utility
In code
0
 
LVL 12

Expert Comment

by:DRRYAN3
Comment Utility
Why?  You have a fixed report here.  Use the designer.  
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:wd3
Comment Utility
Sorry, our T-1 went down I couldn't get back, ameritech's fault.
I think what I need out of the database is too complicated to get it directly with the designer.  What I have above is the result of other computations. I do think I can dump my results into a table and then use the designer. But...I've never used all the features of the command object in th designer. Can you show me how to create the grouping totals I need?
0
 
LVL 12

Expert Comment

by:DRRYAN3
Comment Utility
Are you using Access, SQL Server or some other database?

What is the source of the recordset you described?  Is it a table or an SQL select?




0
 

Author Comment

by:wd3
Comment Utility
SQL. As I said I can put the results in a table, and make a command object to set the report to. The table would have the above info. I need to group and total it.
0
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 150 total points
Comment Utility
Maybe the easiest way to do this is to define a view or a table temporarily that is identical to the structure of your recordset.  Use the RDC Designer to setup your report based on this new view and get the layout and format of the report the way you want it.

At runtime, use report.database.setdatasource(rs) to set the datasource of the report to your recordset.

This way you can let crystal manage the grouping and subtotaling.  All you have to do is get the recordset defined in your app and pass that recordset to crystal.

After you have designed the report you can dump the view or table you used to make the report.  I keep them around for a while in case I need to tweak the report layout.
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi wd3,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept DRRYAN3@avtech's comment(s) as an answer.

wd3, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

743 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

15 Experts available now in Live!

Get 1:1 Help Now