Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: date difference/comparison within several details Post Reply Post New Topic
<< Prev Page  of 3
Author Message
benner
Newbie
Newbie


Joined: 18 Mar 2010
Online Status: Offline
Posts: 23
Quote benner Replybullet Posted: 18 Mar 2010 at 10:52am
We don't always necessarily have just two rows.  Might be more based on hom many sp payments the patient makes.  Here is my formula...I'm getting zero's when I use the min...if i use max it works but I really want the min on the sp part as some patient's make multiple self pay pmts...so I want first sp payment date that is posted.
 
datediff('d',(Maximum ({@Ins Pymnt date}, {DS_ENCOUNTER_PAYMENTS.ENCOUNTER_NUMBER})),
(Minimum ({@SP Pymnt date}, {DS_ENCOUNTER_PAYMENTS.ENCOUNTER_NUMBER})))
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Mar 2010 at 11:38am
try changing your formula to throw in a large future date on the else when it is an SP type...
sp payment formula to:
if {DS_ENCOUNTER_PAYMENTS.INSURANCE_PLAN_CODE} = "SP" then
{DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE}
else dateadd('yyyy',12,currentdate)
IP IP Logged
benner
Newbie
Newbie


Joined: 18 Mar 2010
Online Status: Offline
Posts: 23
Quote benner Replybullet Posted: 19 Mar 2010 at 2:45am

Here is my formula now for the sp pmt:

if {DS_ENCOUNTER_PAYMENTS.INSURANCE_PLAN_CODE} = "SP" then

date(mid(totext({DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE},0,''),5,2) + '/' + mid
(totext({DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE},0,''),7)+'/'+left
(totext({DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE},0,''),4))else

else dateadd('yyyy',12,currentdate)
 
I get the error "a number, currency amount, boolean, date, time,date-time or string is expected here"
 
IP IP Logged
benner
Newbie
Newbie


Joined: 18 Mar 2010
Online Status: Offline
Posts: 23
Quote benner Replybullet Posted: 19 Mar 2010 at 2:48am
Sorry...too early in the morning...I had two "esle"...I'm testing now.  Will let you know how it turns out.
IP IP Logged
benner
Newbie
Newbie


Joined: 18 Mar 2010
Online Status: Offline
Posts: 23
Quote benner Replybullet Posted: 19 Mar 2010 at 2:58am
Here is the formula now and this works except when the patient does not have a self pay payment.  If there is no self pay payment can we make the date zero?  So the date diff will calculate a zero? 
 
if {DS_ENCOUNTER_PAYMENTS.INSURANCE_PLAN_CODE} = "SP" then

date(mid(totext({DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE},0,''),5,2) + '/' + mid
(totext({DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE},0,''),7)+'/'+left
(totext({DS_ENCOUNTER_PAYMENTS.PAYMENT_POSTING_DATE},0,''),4))else
dateadd('yyyy',12,currentdate)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Mar 2010 at 3:49am
Maybe:
if Minimum ({@SP Pymnt date}, {DS_ENCOUNTER_PAYMENTS.ENCOUNTER_NUMBER})=
dateadd('yyyy',12,currentdate) then 0
else
datediff('d',(Maximum ({@Ins Pymnt date}, {DS_ENCOUNTER_PAYMENTS.ENCOUNTER_NUMBER})),
(Minimum ({@SP Pymnt date}, {DS_ENCOUNTER_PAYMENTS.ENCOUNTER_NUMBER})))
IP IP Logged
benner
Newbie
Newbie


Joined: 18 Mar 2010
Online Status: Offline
Posts: 23
Quote benner Replybullet Posted: 19 Mar 2010 at 3:55am
It works!  Thank you for all your help on this!  This is a great forum.
 
Thanks again!Tongue
IP IP Logged
Kohinoor
Newbie
Newbie
Avatar

Joined: 16 Sep 2010
Location: India
Online Status: Offline
Posts: 1
Quote Kohinoor Replybullet Posted: 16 Sep 2010 at 8:44pm
hi friends
i am using this formula in suppress in crystal report
bcoz i need to compare that date difference is less then 30


if (datediff('d', date({@AsOnDate}), date({command.ImportDate})) > 30)
then true else false

thank you for helping me
i learn it from here only
but still i have some problem so please help me more
thank you again

kohinoor
hi i am software developer from gandhinagar,gujarat, india
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Sep 2010 at 3:48am
1. what is the Asondate formula?
2. what is the problem you are having?
3. drop the if and then portion as it is not needed...
datediff('d', date({@AsOnDate}), date({command.ImportDate})) > 30
IP IP Logged
<< Prev Page  of 3
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.