Link to home
Create AccountLog in
Avatar of Kathy_O
Kathy_O

asked on

datediff

Dear Experts Group,

I am trying to write a formula like this :
(order_date formula)
If order.proc_id in [124237,500312] then
minimum({order.date_time}, pat_id)

it is grouped on the pat_id and I am trying to find thier min order date.  

Now for the fun part....
I need to do a datediff formula on this:
(datediff formula)
datdiff('h', {order_date formula}, {med.rev_datetime})

then I will create another formula that will check for a 24/hr range something like this
(datediff formula) <= 24

Thanks,
K:)
Avatar of Mike McCracken
Mike McCracken

What do you want returned for the order date if the proc_id is not one of those 2?

mlmcc
Avatar of Kathy_O

ASKER

I thought about puting that piece in the record selection but I am not sure that would work because I am already looking at at a pat_class.  I guess it would have to be a null date value or wait maybe sysdate might work because that would be outside of the 24 hrs of the record_time.
Avatar of Kathy_O

ASKER

The piece I am talking about is the proc_id sorry in my first statement.  Thanks!
If you only want data for those then I would put it in the record selection.

mlmcc
Avatar of Kathy_O

ASKER

I still had a problem with the min date. minimum({order.date_time}, pat_id)
so I think it may need a variable.  I need that 24 hour window for those proc_id's.  How would you go about that?
SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Kathy_O

ASKER

I am trying to find out if the min of the order was reviewed in a 24 hr period.

1) If order.proc_id in [124237,500312] then give me the first order(min)
2) then take that result and find out the difference datdiff('h', {order_date formula}, {med.rev_datetime})
3) then compare with the <= 24 hrs formula

does that make sense? I hope I explained that clearly.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Kathy_O

ASKER

thanks for the help!!