Hi All -
Hoping someone can help me. Can't figure out what is wrong with this visibility. I am trying to have a certain lab result show for:
PATIENT.DATEOFBIRTH =>01/01/1965 AND PATIENT.DATEOFBIRTH =<12/31/1945
Its not working though.
Has anyone had luck with this?
If you are looking for DOB between 12/31/45 and 1/1/65 inclusive, your operators are not correct.
Try this: PATIENT.DATEOFBIRTH =<01/01/1965 AND PATIENT.DATEOFBIRTH =>12/31/1945
is there not a way to have it look for DOB between 1945 and 1965?
Unfortunately I don't do any work with VFE, so if there is, perhaps someone else will chime in.
Okay thank you! 🙂
Alas, life is not simple. VFE does not deal with dates in an intuitive way. You need to use the DurationDays() symbol. The details are in the Help file. Briefly, DurationDays(date1,date2) returns a string, not value, of the difference between in days between date2 and date1, the result is signed. For example DurationDays("11/25/2002","03/06/2003") returns the string 101. DurationDays("03/06/2003","11/25/2002") returns -101. If you need to do math logic on the result, then you must convert the string to a value.
Hope this will get you started.
This function might work for what you're trying to do...please note, I didn't test it.
fn checkDateFor4565()
{
local retStr = "FALSE"
local dob = str(PATIENT.DATEOFBIRTH)
local year = ""
cond
case dob == "":
case size(dob) 10:
else:
year = sub(dob, 7, 4)
if val(year) >= 1945 and val(year) <= 1965 then
retStr = "TRUE"
endif
endcond
return retStr
}
Just tried and it didn't work :/
Were there any error messages in the MEL Trace?
There were not!
let me try it again
IT WORKS! 🙂 You're the best!
I don't know DanaH is familiar with how to build functions and use them in a visibility field.
does your VFE look like the screenshot that chaddix posted? I know that if you have a function entered wrong, it will not even run, hence, no MEL trace.
We got it to work by using the following code:
{PATIENT.DATEOFBIRTH => "01/01/1945" AND PATIENT.DATEOFBIRTH <= "12/31/1966"}