Link to home
Start Free TrialLog in
Avatar of susnewyork
susnewyorkFlag for United States of America

asked on

Using data from a formula for a parameter

If i have two formula fields which calculate the dateDiff's of two dates by days, how can I use the data from both formulas as a single parameter?

Example:

Doc A Days between Start and stop:  70
Doc B Days between Start and Stop: 30

User needs to see all records that fall between 25 and 55 days and it needs to be pulled records need to be shown from both tables.
Avatar of Mike McCracken
Mike McCracken

What are the formulas?

Are the tables joined?

mlmcc
Avatar of susnewyork

ASKER

The tables are Left joined to a patient table. The formulas show the difference between two dates producing a number.

Formula 1 Start Stop:
if {pt_docs.template_file}='Doc A' then {signoff_hx.create_timestamp}-{@admitdate}-30
else
if {pt_docs.template_file}='Doc B'  then {signoff_hx.create_timestamp}-{@lastHistory}-90

Open in new window


Formula 2 Start Stop:
Basically the same as one, but more logic involved which selects the most recent date from a possible 7. The end result is:
CurrentDate-{@nextDueDate}
I just rethought this, although it may be the same logic ultimately.

Instead of numbers, somehow I would need to have two due dates from two different fields fall into one parameter and show results based on the one parameter.
So the formula calculates the DateSigned Off - Date Created.  What is the -30  is that also sutracting?

How about the other one where the number is 90?

Since it says time stamp, is that a date time type or an integer for the number of seconds?

You want to see any that are Date Signed Off - Date Created > 25 and Date Signed Off - Date Created < 55?

mlmcc
The -30 takes away 30 days from DateSigned Off - Date Created and -90 from another calculation.

it's a datetime type.

The user will need to enter a date range and see how many patients show as a result. The results need to fall within the users entered date range. so they will use the parameter to select two dates and then see the results, if possible.
Ignoring the 25 to 55 days from your first post and the days between dates calculations, if you just want to compare a date range entered by the user to two date fields, you could just use:

{date field 1} = {?date range parameter} and
{date field 2} = {?date range parameter}

 Use AND to get the records where both fields are in the range, or OR to get the records where either field is in the range.

 But I'm guessing that what you're really looking for is not that simple.

 James
James.

The date fields are calculated within a formula. I would need to use those dates within the parameter, which doesn't seem easily possible. Any ideas how I can do that?
Depends on the formula.

What formula are you trying to use?

You cannot use a printtime formula so it cannot have WhilePrintingRecords or shared variables

mlmcc
The date formulas don't have WhilePrintingRecords or shared variables. The formulas simply evaluate a set of date fields and choose the latest one, then add 30 or 90 days onto them.
instead of going extra fancy, I used a group which shows different time intervals based on the combined formulas. Any ideas to solve this issue otherwise?
Can you upload the report?

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial