I am trying to get a visibility region to show "Matched" or "Unmatched" depending on the values of two data displays. The formulas I am using for the data displays are displaying correctly but I can't get the "Matched" visibility region to populate even though the displays match. Any help?!?! Below are the codes I am using for the data displays and then the code I was trying to use for the visibility region.
Data display #1:
{fn Location()
{
local Location=""
local loc=getfield(APPT_PRIOR(), ",", "")
local nsize=size(loc)
for
count=1, count<=nsize, count=count+1
do
Location=loc[4]
endfor
return toupper(Location)}
}
Data Display #2:
{DOCUMENT.LOCOFCARENAME}
Matched Visibility Formula:
{Location() == DOCUMENT.LOCOFCARENAME}
Unmatched Visibility Formula:
{Location() <> DOCUMENT.LOCOFCARENAME}
if the matched == shouldn't the unmatched <>
Matched Visibility Formula:
{Location() == DOCUMENT.LOCOFCARENAME}
Unmatched Visibility Formula:
{Location() <> DOCUMENT.LOCOFCARENAME}
Yes, that's what it should have said but the got deleted in my original post. Even though both data displays are displaying identical information it is still coming up as unmatched.
Why Location() in your visibility region?
You are creating a local (should it be global?) variable called Location. So why the () in the formulas?
I already have two data displays comparing the date of the appointment to the date of the document created and the visibility formula is working fine there.
Display #1 Date only from APPT_PRIOR
{fn Appt()
{
local Appt=""
local app=getfield(APPT_PRIOR(), ",", "")
local nsize=size(app)
for
count=1, count<=nsize, count=count+1
do
Appt=app[1]
endfor
return Appt}
}
Display #2 Clinical date of document opened
{sub(str(DOCUMENT.CLINICALDATE), 1, 10)}
Visibility criteria
Matched:
{Appt() == sub(str(DOCUMENT.CLINICALDATE), 1, 10)}
Unmatched:
{Appt() <> sub(str(DOCUMENT.CLINICALDATE), 1, 10)}
So I am just looking at data that you are calling for in your code, and I found a discrepancy in what the APPT_PRIOR( ) is giving you, and the DOCUMENT.LOCOFCARENAME data.
when I run your code in my system, the APPT_PRIOR() that you split into an array has a Location of Care that says MLCHC. but when I call the DOCUMENT.LOCOFCARENAME, it gives me "Moses Lake Community Health Center". Since the Abbreviation and the Full Name do not match, it will always result in an "Unmatched" visibility field.
You will need to either have a separate function to translate each of the Full Names into Abbreviations, or just declare some case statements in your current function to translate an abbreviation into a full clinic name. Do you have many Locations of Care, and are you planning to expand those at all?
Please let me know if you have any questions or concerns with this, and good luck!
Daniel Carpenter.
Thank you for your response Daniel. I did notice that discrepancy when I originally wrote the code. APPT_PRIOR returned a value of Leawood DDMOC and DOCUMENT.LOCOFCARENAME returns LEAWOOD DDMOC. So in my LOC() function, I have it returning a value of toupper(Location) which converts my APPT_PRIOR value to LEAWOOD DDMOC in the data display. It is still saying they are mismatched. I tried using toupper in the visibility region code as well but it was still unmatched.