Hi all,
I'm trying to add a STOP button on the screen for a merge process so the user can stop the loop if the number of certificates on the selected salesorder is high. I added a yield() statement to the loop and a check for the value of the instance variable ib_stop, but it loops through so fast that often times the STOP click is missed. Sometimes if I double-click the STOP button, it works, but not always. Here's the code:
//wf_merge_each
integer li_CertCount, li_ThisCert, li_x, li_rc
//Loop through all of the Certs in the ddlb
ib_stop = FALSE
cb_stop.visible = TRUE
li_CertCount = ddlb_certs.TotalItems()
for li_x = 1 to li_CertCount
st_6.Text = "Merging " + string(li_x) + " of " + string(li_CertCount) + " ... Please wait..."
ddlb_certs.SelectItem(li_x)
ddlb_certs.Event SelectionChanged(li_x)
li_rc = wf_merge_one()
if li_rc = -1 then
return
end if
Yield()
if ib_stop = TRUE then
exit
end if
next
if ib_stop = TRUE then
st_6.Text = "Merged " + string(li_x) + " of " + string(li_CertCount) + " ... Merge cancelled..."
else
st_6.text = "Merge complete: " + string(li_CertCount) +" documents."
end if
cb_stop.visible = FALSE
return
Any thoughts? I tried adding 4 more Yields() but that doesn't fix the problem.
TIA,
Tracy
Thanks Miguel!
~~~Tracy