Total Field counting ^wrong^
-
- Posts: 27
- Joined: Tue Oct 10, 2017 12:44 pm
Total Field counting ^wrong^
using arpeggio v2 connecting to a sqlbase database.____i am trying to count the total number of Master records where a condition in a Child table is true. the problem i^m having is that if the condition is not true for the FIRST record of the child table, the total doesn^t accumulate correctly. i tried making it a pre-processed total, but get the same result.____here is a sample of my data and you can see where CNTCont failed to accumulate on MA.CLAIMNO ^103^ even tho the second detail record was True...____ MA.CLAIMNO, DET.SEQ, DET.ADJ, isCONT, CNTCont __ 100, 1, A1, T, 1__ 101, 1, A1, T, 2__ 101, 2, NR, F, 2__ 102, 1, A1, T, 3__ 103, 1, BB, F, 3__ 103, 2, A1, T, 3__ 104, 1, A1, T, 4____(sorry i can^t seem to get that to display any better!)____isCONT = iif(inlist(DET.ADJ,^A1^,^RMR^)<>0,.t.,.f.))__CNTCont = Count(MA.CLAIMNO, Healthplan(), MA.CLAIMNO, Running, Conditional on isCONT=true)__Sort/Grouping is by Healthplan, MA.CLAIMNO, DET.SEQ____i have wracked my brain trying to find a way to get the count right and have failed to come up with a solution - any help would be appreciated!
=> RE: Total Field counting ^wrong^
Try setting the accumulation frequency of the total to every composite record and see if that helps.____Kathleen__R&R Support
-
- Posts: 27
- Joined: Tue Oct 10, 2017 12:44 pm
==> RE: Total Field counting ^wrong^
kathleen,__when i change it to ^every composite^, then the child records that are True *do* get counted, but then my total is too high because EVERY occurance of ^A1^ or ^RMR^ gets counted and i only want to count once for each Master table regardless of how many times it^s true in the child record...____my sample data set didn^t include a claim with more than one line item adjusted A1, but that^s a common occurence.____do you know of some way that i can make use of the correct running total to get just a count of the master records? everything i^ve tried so far ended up with an error that ^a condition cannot depend on a total field^.____thanks!
=> RE: Total Field counting ^wrong^
Try just totaling ISCOUNT(). When you sum logical fields trues are counted as 1 and false as 0.____Kathleen__R&R Support
-
- Posts: 27
- Joined: Tue Oct 10, 2017 12:44 pm
==> RE: Total Field counting ^wrong^
kathleen,__when i do that, if i accumulate at MA.CLAIMNO, then the record still isn^t counted unless the True is in the first record of the claim. it seems that R&R is deciding to add one or not based on the first child record encountered instead of checking all the associated records...____if a accumulate at composite record level, the True records do get counted, but the total is too high since it^s counting each occurence of True instead of only once per CLAIMNO.____what i^m TRYING to get would look like this:____MA.CLAIMNO, DET.SEQ, DET.ADJ, isCONT, CNTCont __100, 1, A1, T, 1__100, 2, A1, T, 1__101, 1, A1, T, 2__101, 2, NR, F, 2__102, 1, A1, T, 3__103, 1, BB, F, 4__103, 2, A1, T, 4__104, 1, A1, T, 5____notice that CNTCont only accumulates 1 for Claimno 100 even tho there^s more than 1 A1 child record.____that^s how the very straightforward total (Count(CLAIMNO, Healthplan, CLAIMNO, running, Conditional on isCONT = True) works UNTIL you hit the record where the isCONT is false on the first child record. then it skips counting that one even tho the second child record IS True...____Can ANYONE suggest how to get this total accurate??? i^m desperate to get this report working right since it^s a new requirement from ALL of our healthplans...
-
- Posts: 27
- Joined: Tue Oct 10, 2017 12:44 pm
===> RE: Total Field counting ^wrong^
The good news, which i^ll post here for anyone following this thread to find a solution to their own similar problem, is that i figured out a way to correctly calculate this total:____MaxCont:__Maximum(IsCont(), MA.CLAIMNO, DET.SEQ, running)____then____CNTCont:__Sum(MaxCont(), Healthplan, MA.CLAIMNO, running)____and that gets the correct total! huzzah!____the bad news is that i keep getting "The memory could not be ^read^" errors when i^m trying to print the report. it^s such a strange combination of what works (print preview, certain methods of getting it to the printer) and what doesn^t work that i^m going to post it under a seperate subject! ack!
====> RE: Total Field counting ^wrong^
The printer problem is indeed an odd bug (that happens extremely intermittently) with certain printers/systems but the total solution that you found should be a major consolation I hope.____Kathleen__R&R Support