So I have this and am trying to to display lastname, firstname and I'm getting nothing. Any suggestions?
{!fn fnUserLogIn() {
local hold = getfield(GET_USER_LIST("PHYSICIA","","delimited"), "|", "")
local temp
local rslt = ""
local temp = ReplaceStr(hold,",","\,")
for i = 1, i <= size(hold), i = i + 1 do
temp = getfield(hold[i], "^", "")
if (rslt "") then
rslt = rslt
endif
rslt = rslt + temp[2]
endfor
return rslt
}}
Do you need to have some kind of comparison operator in this statement?
if (rslt “”) then
rslt = rslt
endif
something like: if (rslt <> "" ) or if (rslt == "")
Also, have you used a couple USEROK("I'm here") statements to help you make sure that you are getting to the right spots in your code? I've used USEROK() to echo out the value of the variables to make sure that the function is doing what I want it to.
I haven't tried user ok, but I have moved the replacestr around:
{!fn fnUserLogIn() {
local hold = getfield(GET_USER_LIST("PHYSICIA","","delimited"), "|", "")
local temp
local rslt = ""
/*rslt = replacestr(temp[2],",","\,")*/
for i = 1, i <= size(hold), i = i + 1 do
temp = getfield(hold[i], "^", "")
/*temp[2] = replacestr(rslt,",","\,")*/
/*rslt = replacestr(temp[2],",","\,")*/
if (rslt "") then
rslt = rslt
/*rslt = replacestr(temp[2],",","\,")*/
endif
/*rslt = replacestr(temp[2],",","\,")*/
rslt = rslt + temp[2]
/*temp[2] = replacestr(rslt,",","\,")*/
/*rslt = replacestr(temp[2],",","\,")*/
/*userlog = temp[1]*/
endfor
/*rslt = replacestr(temp[2],",","\,")*/
return rslt
}}
So obviously with no replacestr my dropdown has all the users in it, but is scrambled. For example Daniel, Adam shows as daniel one choice and adam the other.
The replacestr here:
rslt = rslt + temp[2]
/*temp[2] = replacestr(rslt,",","\,")*/
Will give me one correct name for some reason its a name that begins with an H.
My understanding is that GETFIELD creates an array, so in this instance the variable "hold" is an array, not a string. I don't think you can use the REPLACESTR function on an array. I could be wrong, but that's the first thing that jumped out at me.
chaddix - That would make since.