I am using a function called ServProvs() in the function view of VFE which is calling parts of the Service Provider table. When I create a Dropdown list (and check-mark Dynamic choice list), and enter ServProvs() at the bottom in the MEL Expression box I cannot get the drop down to work after import. What am I doing wrong?
For reference, I tried entering my function ServProvs() in a data display and it does result in a comma separated list of service providers. I also tried doing the dynamic List Box option and it does not work there either. So I'm fairly sure my function is working, but it's just not being "seen" as comma separated list I guess.
My function in the function view:
{fn ServProvs()
{
local a = getrowcount("_ServiceProviders")
local temp = ""
local ret = ""
for i = 0, i < a, i = i + 1
do
temp = getrow("_ServiceProviders",i,"ListName","Phone1")
if ((temp[1] == "") AND (temp[2] == "")) then
continue
endif
if (ret <> "") then
ret = ret + ","
endif
cond
case ((temp[1] <> "") AND (temp[2] <> ""))
ret = ret + replacestr(temp[1], ",", ";") + " Phone: " + replacestr(temp[2], ",", ";")
case (temp[1] <> "")
ret = ret + replacestr(temp[1], ",", ";")
case (temp[2] <> "")
ret = ret + replacestr(temp[2], ",", ";")
else
//not sure how we got here
continue
endcond
endfor
return ret
}}
I'm pretty sure all you need to do is update the function to have ! so that it is loaded before it is called by the dropdown.
{!fn ServProvs()
{
local a = getrowcount("_ServiceProviders")
local temp = ""
local ret = ""
for i = 0, i < a, i = i + 1
do
temp = getrow("_ServiceProviders",i,"ListName","Phone1")
if ((temp[1] == "") AND (temp[2] == "")) then
continue
endif
if (ret <> "") then
ret = ret + ","
endif
cond
case ((temp[1] <> "") AND (temp[2] <> ""))
ret = ret + replacestr(temp[1], ",", ";") + " Phone: " + replacestr(temp[2], ",", ";")
case (temp[1] <> "")
ret = ret + replacestr(temp[1], ",", ";")
case (temp[2] <> "")
ret = ret + replacestr(temp[2], ",", ";")
else
//not sure how we got here
continue
endcond
endfor
return ret
}}
That was exactly right. So close. Thanks Mike!
Mike,
Maybe I can pick your brain on one more thing?
How do I filter the service provider list for those with only a specific specialty? The specialty is called LMHA and the Field I need to call is Specialty, so I only want the list where Specialty == "LMHA"
Thanks,
Crystal
You need to update the getrow() to pull Specialty field and add your if statement to the loop.
BTW, _ServiceProviders is a mldef object that is in the client folder of your Centricity machine. Usually something like C:\Program Files (x86)\Centricity Practice Solution\Client\mldefs3.txt
{!fn ServProvs()
{
local a = getrowcount("_ServiceProviders")
local temp = ""
local ret = ""
for i = 0, i < a, i = i + 1
do
temp = getrow("_ServiceProviders",i,"ListName","Phone1", "Specialty")
if ((temp[1] == "") AND (temp[2] == "")) then
continue
endif
if (ret <> "") then
ret = ret + ","
endif
if (temp[3] == "LMHA") then
cond
case ((temp[1] <> "") AND (temp[2] <> ""))
ret = ret + replacestr(temp[1], ",", ";") + " Phone: " + replacestr(temp[2], ",", ";")
case (temp[1] <> "")
ret = ret + replacestr(temp[1], ",", ";")
case (temp[2] <> "")
ret = ret + replacestr(temp[2], ",", ";")
else
//not sure how we got here
continue
endcond
endif
endfor
return ret
}}