Solved

QuickReport Count problem

Posted on 2006-10-27
9
317 Views
Last Modified: 2013-11-22
I am using D4 Pro and the QuickReport components.  I am working with a donor database and I need to count the number of donations made.

The problem is that the amount donated is split into various projects and using the count function in an expression counts each split item instead of just the number of dates.  How do I make it do what I want?

example:

11 Jan 2006      $25    ASW
                       $25    CBF
                       $25    LMF

5 May 2006      $30    ASW
                       $10   CCP

In the footer if i use Count I get 5 but i want to have 2

TIA

John
0
Comment
Question by:jdthedj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 17826931
Simplest way to do this is to create another table and distill the info you want into that table in the way you want.  You then use QR with that table.
0
 
LVL 3

Author Comment

by:jdthedj
ID: 17827438
Thanks for the reply moorhouselondon - the data is already in a table populated from a query, but I am still stuck.  The table has the fields Date, Code and Amount.
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 17827999
It's a while since I used QR but I would use the Event triggers in QR to do the calculations.  If you iterate through the records using a separate TTable element you can calculate the total you need (the Count of records), without interfering with the TTable which is hooked in with QR.  There is a more elegant way of doing this I am sure, but this is a viable work-around.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:calinutz
ID: 17828858
It's all about grouping bands...
If I recall there should be a Group footer band you can use and place  some counter on it.

regards
0
 
LVL 9

Expert Comment

by:sun4sunday
ID: 17831886
You have to use the group band using the date to group your data and as calinutz mentioned use group footer to get the count of each group.

sun4sunday
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 17832085
It would presumably need to be grouped by Date and Donor because two or more donations may come in on the same day.  
0
 
LVL 3

Author Comment

by:jdthedj
ID: 17839516
Thanks for all the replies.  

I need to put the count result in the report footer of summary band.  The data is grouped by date as shown in the example, but the count function counts all the entries - not just the number of dates.  I tried moorhouselondon's idea of counting the dates first and then adding that number to each record in the table, but it seems very convoluted.  My ap loads the dfm file containing the report at runtime so has no code associated with it.

There must be a better way....
0
 
LVL 31

Accepted Solution

by:
moorhouselondon earned 250 total points
ID: 17840312
You don't need to go to that extent.  One way to do it is to use the technique of having two ttables.  One that counts the dates, the other is under QR's control.  You could simply have a QRLabel positioned on the Summary band and, before running the Report you simply say

qrlabelx.caption:=summaryvalue;

This is a sledgehammer approach.  Calinutz/sun4sunday's method is the correct way to do it but if you haven't the inclination to spend lots of time on learning the intricacies of QR, it will work.  If however, you need sub-totals and page totals etc, then there's no real substitute for doing it the correct way.
0
 
LVL 3

Author Comment

by:jdthedj
ID: 17846324
Thanks moorhouselondon

I have tried to use Calinutz/sun4sunday's methods but as staed above the count expression counts each line in the detail section - not just the dates in the header.  I would prefer to do it with headers and footers but I cannot get it to work that way.

If Calinutz or sun4sunday can show me a working example I will go that way, but if not I will award you the points for the *quick and dirty* approach.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Spellcheck in Webbrowser 1 74
Delphi Firemonkey send email on Android 1 72
Firemonkey Queue list 1 50
Add New Database Table in database file using delphi 3 53
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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