Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Total Appears To Be Counting Incorrectly 1

Status
Not open for further replies.

Sange

Technical User
Jun 10, 2002
85
AU
Hi,

I am using CRv10.

I have developed a report which will list the amount of times a prisoner has moved cells (placement). I am only interested in prisoners who have moved at least once.

The report is grouped by:
1. Facility
2. Prisoner Name
3. Custody Number

Each placement is given a unique number (placement_id) and I added this id to the details section of the report and added a distinct count by group 3 (Custody Number).

I then added a group selection to the select statement to only return records where the distinct count of placment_id was greater than 1.

I thought I could add a running total (distinct count of custody number) to give me the total number of prisoners however it isn't counting all of the records. What I mean by not counting all the records is that the running total is not always increasing each time the custody number changes.

I then added a formula to the same running total ie. if distinctcount(placement_id, custody_number) > 1 then true but this still isn't counting the records.

Is there something I am missing. I have spent so much time on this and do not appear to be getting any closer to resolving it.

Any assistance would be appreciated.

Thank you.
 
Try using a variable instead of a Running Total.

Place this in your custody footer

@Custody Count

whileprintingrecords;

global numbervar custody;

If placement RT > 1 then custody:= custody+1;

In report footer


@Display Custody Count

whileprintingrecords;

global numbervar custody;


Ian
 
Where are you placing the running total? It needs to appear in a report footer section. Is there one custody number per prisoner? If so, your running total should work as is--as long as your intent is to count those with multiple placements. You don't need any special evaluation formula, and the reset should be set to "never".

-LB
 
Thanks to the both of you, I really appreciate it.

The running total is in the report footer and because the report is run over a date range, a person could potentially have more than one custody number if he's been particularly naughty over a period of time :)

If he has been released from prison and then re-admitted for new matters over the date range entered then a new custody number is generated.

As a result, a person could have more than one custody number - could this be the problem? I found that if I deleted all the group headers and only kept the custody number group, then the running total I created worked correctly. As soon as I added the facility name it started to go wonky again - for the life of me I can't work out why!!

On a different note, Ian Waterman's solution does appear to be working irrespective of how many groups I have above the custody number so that's great news but I would love to understand why my initial approach isn't successful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top