Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Compare values between detail lines Post Reply Post New Topic
Author Message
KeithRoberts
Newbie
Newbie
Avatar

Joined: 20 Feb 2012
Location: United States
Online Status: Offline
Posts: 3
Quote KeithRoberts Replybullet Topic: Compare values between detail lines
     Posted: 20 Feb 2012 at 6:50am
I am using Crystal Reports XI and need to compare two fields from line 2 to line 1 and populate three fields based on those comparisions.  For example:
 
CLAIMNO
ADMDATE
DSCHDATE
Admits 1
Admits 2
Admits
clm101199900165
9/16/11
9/16/11
1
1
1
clm101199900165
9/16/11
9/16/11
0
0
0
clm101199900165
9/16/11
9/16/11
0
0
0
clm101199900165
9/16/11
9/16/11
0
0
0
clm101199900165
9/16/11
9/16/11
0
0
0
clm101199900165
9/16/11
9/16/11
0
0
0
clm030499901464
1/30/11
1/30/11
1
1
1
clm060899900366
5/17/11
5/17/11
1
1
1
clm060899900366
5/17/11
5/17/11
0
0
0
clm091699900285
8/28/11
8/28/11
1
1
1
clm122199900501
12/1/11
12/1/11
1
1
1
clm120299900126
11/12/11
11/12/11
1
1
1
clm120299900126
11/12/11
11/12/11
0
0
0
clm120299900126
11/12/11
11/12/11
0
0
0
clm120299900126
11/12/11
11/12/11
0
0
0
clm120299900126
11/12/11
11/12/11
0
0
0
clm110899902071
10/16/11
10/16/11
1
1
1
 
The purpose is to count a patient admission only once.  The excel formulas that are used are:
 
Admit 1
=IF(OR(AND(claim2<>claim1,claim2=claim3),AND(claim2<>claim1,claim2<>claim3)),1,0)
 
Admit 2
=IF(admit2&discharge2=admit1&discharge1,0,1)
 
admit 3
=IF(admitcalc1=0,admitcalc1,admitcalc2)
 
Please note that the numbers on the field names in the formulas correspond to the line numbers...  these formulas came from the excel spreadsheet
 
It has been a long time since I worked in Crystal Reports, so any help that you can give me will be greatly appreciated!!!
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 20 Feb 2012 at 12:08pm
you can use Previous and Next to look at the appropriate row in the datatable.
 
the biggest caveat is that they don't 'respect' group boundaries so you will need to check that in your formula as well.
 
the other caveat, is that they will only go 1 row in either direction
 
HTH
IP IP Logged
KeithRoberts
Newbie
Newbie
Avatar

Joined: 20 Feb 2012
Location: United States
Online Status: Offline
Posts: 3
Quote KeithRoberts Replybullet Posted: 20 Feb 2012 at 4:23pm
Thanks!!!  But now to through a little wrinkle in this...
 
the records are grouped by claim number...
 
so I need to compare at the group level as opposed to the record level.
 
How do I compare group fields both previous and next...
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 21 Feb 2012 at 4:43am
if you want to compare one group against another, I would use running totals or shared variables, either of which will allow you to access the total of a previous group.
 
HTH
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 21 Feb 2012 at 5:36am
if its grouped by claimno then you could try to use a formula for admits like
count({table.admdate}, claimno)
or something like
distinctcount(table.patientID,claimno)

also wouldn't it be just a distinct claim count since there is only one
admission per claim.
IP IP Logged
KeithRoberts
Newbie
Newbie
Avatar

Joined: 20 Feb 2012
Location: United States
Online Status: Offline
Posts: 3
Quote KeithRoberts Replybullet Posted: 21 Feb 2012 at 6:54am
Unfortunately, there are multiple lines per a claim with different dates of service.  If a person checks into the ER, there can be multiple claims for that one person depending on how the hospital is organized.  Therefore, we group by claim number in order to summarize the totals.  What makes it more difficult is if the claim is a CAP claim (under contract) or a 3rd party claim.  The amounts are stored in different fields.  So, we will summarize the claim by grouping it.  Then we need to sort it by provider, member, claim number, from date of service.  based on this, then we can determine if the patient has one admit or multiple admits. 
 
Currently, we group the records in Crystal Reports and then export to Excel.  But as we use Crystal Reports XI, it exports to Excel 2003 workbooks.  There is a limitation of 65,536 records per worksheet.  We have to convert the workbook to Excel 2010, copy the worksheets into one master worksheet, then perform this calculation.
 
I am attempting to perform all in Crystal Reports.  I want to be able to summarize the claims, then sort it, then apply the formulas to determine number of admissions.
 
I am very much open to any suggestions...
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 21 Feb 2012 at 7:20am
"But as we use Crystal Reports XI, it exports to Excel 2003 workbooks.  There is a limitation of 65,536 records per worksheet. "
you could upgrade the crystal reports to 2011 which lets you export up to
1000000+ rows

as to your crystal report question
formula like
distinctcount({table.admdate}, claimno)
should give you a count of patient admissions
if you need more help then give an example of your raw data and
what you want it to look like(end result)

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum