Hello Lee, Thank you for your suggestions. dataSymbol and returnIdentifier are parameters to the function. I included the complete function below. Also fnOrderToArray and getRelevantOrders are both in libaray.
I will change the variable names to see if it makes any difference.
{fn fnOrderToArray(dataSymbol, returnIdentifier)
{
local orderArray = getfield(dataSymbol, "|", "")
local i, n, relevantOrders = "", retString = ""
local orderDesc, serviceProvider,placeHolderArray
returnIdentifier = getfield(returnIdentifier,"|","")
local orderFlag = val(returnIdentifier[1])
local searchString = returnIdentifier[2]
for i=1, i<=size(orderArray), i=i+1 do
orderArray[i] = getfield(orderArray[i], "^", "")
endfor
for n=1, n<=size(orderArray),n=n+1 do
orderDesc = replacestr( (tolower(str(orderArray[n][1])) + " [" + str(orderArray[n][3]) + "]" ), ",","")
orderStatus = orderArray[n][20]
placeHolderArray = orderStatus + "^" + orderDesc
cond
case orderFlag == 3
if match(tolower(orderDesc),1,searchString)>0, relevantOrders = relevantOrders + "|" + placeHolderArray, ""
case orderFlag == 4
serviceProvider = (if str(orderArray[n][13]) <> "", str(orderArray[n][13]) + hret, "")
+ (if str(orderArray[n][14]) <> "", str(orderArray[n][14]) + hret, "")
+ (if str(orderArray[n][15]) <> "", str(orderArray[n][15]) + hret, "")
+ (if str(orderArray[n][16]) <> "", str(orderArray[n][16]) + hret, "")
+ (if str(orderArray[n][17]) <> "", str(orderArray[n][17]) + hret, "")
cond
case searchString == "kphc"
if match(tolower(serviceProvider),1,searchString)>0, relevantOrders = relevantOrders + "|" + placeHolderArray, ""
case searchString == "hdrs"
if match(tolower(serviceProvider),1,searchString)>0, relevantOrders = relevantOrders + "|" + placeHolderArray, ""
case searchString == "imaging"
if match(tolower(serviceProvider),1,searchString)>0 and match(tolower(serviceProvider),1,"hdrs")<=0, relevantOrders = relevantOrders + "|" + placeHolderArray, ""
case searchString == "rest"
if match(tolower(serviceProvider),1,"kphc")<=0 and match(tolower(serviceProvider),1,"imaging")<=0, relevantOrders = relevantOrders + "|" + placeHolderArray, ""
endcond
endcond
endfor
cond
case orderFlag == 3 or orderFlag == 4
retString = getRelevantOrders(relevantOrders)
endcond
return retString
}
}
Posted : July 28, 2017 6:41 am