Solved

DataReport Grouping

Posted on 2001-06-12
11
579 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
ID: 6182257
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
ID: 6182520
I keep getting Datareport does not match sections.
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6182568
Are you trying to build the datareport in code or are you using the designer?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:wd3
ID: 6182575
In code
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6182591
Why?  You have a fixed report here.  Use the designer.  
0
 

Author Comment

by:wd3
ID: 6186674
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
ID: 6186820
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
ID: 6186881
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
ID: 6187163
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
ID: 7135971
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
ID: 7169196
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

776 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