Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining formulas

Status
Not open for further replies.

mark12010

IS-IT--Management
Apr 28, 2010
32
US
I have 2 formulas in a sub-report.One gives me the number of days since a patients last appt. and one displays "NO APPT. DATA ON FILE" if {billing_tx_history.date_of_service} is Null. How can I combine the 2? The formulas are as follows
1) Numbervar Days;
Days := DateDiff ("d",{billing_tx_history.date_of_service}, CurrentDate);

2) IF ISNULL ({billing_tx_history.date_of_service})
THEN "NO APPT DATA ON FILE"

I am running this on CR XI
 
I got this from -LB
Numbervar Days;
if (
isnull({billing_tx_history.date_of_service}) or
TRIM({billing_tx_history.date_of_service})=""
) then
Days := 99999999 else
Days := DateDiff ("d",{billing_tx_history.date_of_service}, CurrentDate);
if Days = 99999999 then
"No appt data on file" else
"Patient last seen " + totext(Days,0,"") + " days ago";

but it gives me an error at:
TRIM({billing_tx_history.date_of_service})=""
{billing_tx_history.date_of_service} is highlighted and it says
A sting is required here.


 
Just remove or TRIM({billing_tx_history.date_of_service})=""

This was added as I believe the original formula was developed for the field {billing_tx_history.date_of_service} being a datestring. As your field is a date isnull() is sufficient.

Ian
 
I removed or TRIM({billing_tx_history.date_of_service})=""

Numbervar Days;
if isnull({billing_tx_history.date_of_service})
then Days := 99999999
else Days := DateDiff ("d",{billing_tx_history.date_of_service},CurrentDate);
if Days = 99999999 then
"No appt data on file" else
"Patient last seen " + totext(Days,0,"") + " days ago";
It did not throw any errors and it works if ({billing_tx_history.date_of_service}) has a value but if it isnull it just shows a blank field
 
In File ->Report Options is the Convert database nulls to default checked. If it is try unchecking.

Ian
 
It is not checked. This shoudnt be this hard I dont know why it isnt working.
 
Try:

Numbervar Days;
if isnull({billing_tx_history.date_of_service}) or
{billing_tx_history.date_of_service} = date(0,0,0) then
Days := 99999999 else
Days := DateDiff ("d",{billing_tx_history.date_of_service},CurrentDate);
if Days = 99999999 then
"No appt data on file" else
"Patient last seen " + totext(Days,0,"") + " days ago";

-LB
 
-LB I tried what you said and It still only works if ({billing_tx_history.date_of_service}) has a value but if it isnull it just shows a blank field
 
Please explain where you are placing this formula (what section).

Please do a test and place this formula in the detail section:

if isnull({billing_tx_history.date_of_service}) or
{billing_tx_history.date_of_service} = date(0,0,0) then
99999999

And then also add a formula like this:

len(totext({billing_tx_history.date_of_service},"MM/dd/yyyy"))

Then report back on the results for these formulas.

-LB
 
when I use:
if isnull({billing_tx_history.date_of_service}) or
{billing_tx_history.date_of_service} = date(0,0,0) then
99999999
it returns 99999999 if billing_tx_history.date_of_service isnull and returns 0 if billing_tx_history.date_of_service is not null

when I run:
len(totext({billing_tx_history.date_of_service},"MM/dd/yyyy"))
it shows a blank field if billing_tx_history.date_of_service isnull and returns 10 if billing_tx_history.date_of_service is not null
I dont see how this is going to get me what i need.
 
Well, that tells me there is nothing wrong with the formula, so I'm wondering whether you have added a reset formula somewhere that sets Days := 0?

Otherwise I think you should copy and paste your actual formula into the thread (if you didn't earlier). Specifically, I wonder whether you have the same number of 9's in both places or whether you have incorrect punctuation in the formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top