Hello,
I am using the following to get my list of problem descriptions to assess.
{!fn LoadProblemDropDown(prob_after){
local prob_arr = getfield(prob_after,"|","")
local max = size(prob_arr)
local j = 1
local prob_str = ''
while j <= max do
local m = getfield(prob_arr[j],'^','')
local tempStr = ReplaceStr(m[2],",","\,")
if prob_str == "" then
prob_str = m[1] + " " + tempStr
else
prob_str = prob_str + "," + m[1] + " " + tempStr
endif
j = j+1
endwhile
return prob_str
}
}
Can anyone help me create a userok to pop up if a problem descriptop is selected more than 1 time for assessment.
Thank you!
You could probably do a MATCH against LISTASSESSNEW. Look for the problem description selected for assessment in the results of LISTASSESSNEW.
I tried the following because I wanted the pop up to fire when they select from the drop down and it does not work:
{! fn dupproblems(prob_str)
{
local PROB = getfield(PROB_AFTER("delimited"), "|", "")
local MAX = SIZE(PROB)
local COUNT, RETURN = "", GETPROB
for COUNT = 1, COUNT <= MAX, COUNT = COUNT + 1 do
GETPROB = getfield(PROB[COUNT],"^","")
if prob_str = "" then "" else
if MATCH(GETPROB[2],1,GETPROB[2])>0 then return userok("You have selected a problem more than once for evaluation. Make another selection !") else "" endif
endif
endfor
RETURN ""}}
Assuming you are passing the problem they selected to asses as the parameter to this function (prob_str), you never actually compare prob_str to anything from PROB_AFTER. Your MATCH is comparing the same field to itself (GETPROB[2]). If you are passing what you want to check for duplicating to this function, your entire function core logic could consist of
MATCH(LISTASSESSNEW(),prob_str)> 0
No real need for an array and looping.
The only thing I'm a little fuzzy on is if you have to use a return on the MATCH/USEROK statement.
You may need to do a trace to see how your code is actually working.