Hi everyone.
I’m having some trouble with the variables for a visibility region. I’m in a bit of a time crunch due to Meaningful Use and would really appreciate any guidance you guys can give me. Here’s the code I’m trying to use that isn’t working:
OBSNOW("BMI") >="30" AND
OBSANY("DIET COUNSEL") == "" OR
DURATIONDAYS(LASTOBSDATE("DIET COUNSEL"),str(_TODAYSDATE))>=180
You can see what I’m trying to do. I only want the section visible if the BMI is >= 30 and if DIET COUNSEL has never been populated, but another scenario in which I need it to display is if the date of last obs value for DIET COUNSEL is greater than 6 months (180 days).
How would I handle this? Am I coding the visibility section wrong? Or is this just not the way to approach this. Is there a way to “clear out” an observation term to make the visibility work. Basically, some coding in the background of the form that says…if DIET COUNSEL is older than 6 months, assume it’s blank..which would make the first two arguments of the above code work as desired?
I’m at a loss. Help, please…
Try this:
VAL(OBSNOW("BMI")) >=30 AND
OBSANY("DIET COUNSEL") == "" OR
DURATIONDAYS(LASTOBSDATE("DIET COUNSEL"), STR(._TODAYSDATE))>=180
jjordet said:
Try this:
VAL(OBSNOW("BMI")) >=30 AND
OBSANY("DIET COUNSEL") == "" OR
DURATIONDAYS(LASTOBSDATE("DIET COUNSEL"), STR(._TODAYSDATE))>=180
Actually, from reading what you are looking for I think you need this (parentheses around your first scenario):
(VAL(OBSNOW("BMI")) >=30 AND
OBSANY("DIET COUNSEL") == "") OR
DURATIONDAYS(LASTOBSDATE("DIET COUNSEL"), STR(._TODAYSDATE))>=180
If that's what you're looking for, then the extra parentheses are not needed…'and' is evaluated before 'or'...but always better to add them for clarity and when you're unsure of the order of evaluation.
Sorry for the delayed response. Thanks for your help! I think I finally got it working as desired by puting the second visibility argument in parentheses as well:
(VAL(OBSNOW("BMI")) >=30 AND
OBSANY("DIET COUNSEL") == "") OR
(VAL(OBSNOW("BMI")) >=30 AND
DURATIONDAYS(LASTOBSDATE("DIET COUNSEL"), STR(._TODAYSDATE))>=180)
Thanks again!
In this case, you could do:
VAL(OBSNOW("BMI")) >=30
AND (OBSANY("DIET COUNSEL") == ""
OR DURATIONDAYS(LASTOBSDATE("DIET COUNSEL"), STR(._TODAYSDATE))>=180)