While debugging a procedure from sometime last year I discovered the following code:
select arraysearch(lvArDecline,«memno»,1,cr())>0
Where lvArCommit is an array of Member Numbers formed earlier in the procedure, and «memno» is the Member Number field. I don’t recall how I came up with this (something similar is discussed in the Pan 6 topics) but it works, except when it doesn’t.
I have three iterations of the following sequence:
select arraysearch(lvArDecline,«memno»,1,cr())>0
if info(“Empty”)
lvDeclineTotal=0
else
field «ASK»
Total
lvDeclineTotal=«ASK»
endif
removeallsummaries
The difference is just the variable holding the Member Numbers.
The correct records are selected with each array.
I can run the full procedure over and over with no errors in the first to iterations, but the third sometimes gets it right, sometimes produces the same error. The recurring error is the «ASK» field not totalling.
if I use
lvDeclineTotal=pattern(«ASK»,“$#,.##”)
the «ASK» field will fail to total about 4 times, total correctly once or twice, then back to not totalling. If I take off the pattern( ) , the result alternates between not totalling and correctly totalling.
This procedure has been working fine for the last year because the lvArDecline search always turned up Empty. Now that it has two records, the error shows up.
Assuming I’ve done something wrong along the line, but not seeing it. That the correct records are chosen with the select arraysearch() seems to indicate that is not the problem, but everything else seems pretty straight forward.