So I've been successful using less than and greater than, but I need help with between values. For example:
{if OBSNOW("HGBA1C") < val("6.9") then "3044F" else if OBSNOW("HGBA1C") > val("9.1") then "3046F" else if OBSNOW("HGBA1C") > val("6.9") and < val("9.1") then "3044F" "" endif endif endif}
Of course this piece: ...if OBSNOW("HGBA1C") > val("6.9") and < val("9.1") then "3044F" "" endif... doesn't work.
Any ideas?
Thanks in advance!
Wow, second cup of coffee and I found my issue:
{if OBSNOW("HGBA1C") < val("6.9") then "3044F" else if OBSNOW("HGBA1C") > val("9.0") then "3046F" else if OBSNOW("HGBA1C") > val("6.9") and OBSNOW("HGBA1C") < val("9.1") then "3045F" endif endif endif}
While it is a matter of style, for readability and efficiency, you might want to use condition statements for this type of evaluation.
cond
case OBSNOW("HGBA1C") < 6.9 "3044F"
case OBSNOW("HGBA1C") > 9.0 "3046F"
case OBSNOW("HGBA1C") > 6.9 and OBSNOW("HGBA1C") < 9.1 "3045F"
else ""
endcond
Mostly it is cleaner, easier to work with, and you don't have to count if/endif pairs. 🙂
Thank you! I guess I've steered clear of cond case simply because I'm not comfortable with them, but this definitely cleans it up better and gives me something to work with in the future.
Just a quick question: Are you deliberately trying to exclude 6.9 from being translated into a code?
I ask because I see that you changed one of your 9.1 values to 9.0, so that you can have all values in the range >9.0 and <9.1, but you are still using >6.9 and <6.9 what happens if your value is equal to 6.9?
I overlooked this, thanks!