dantheinfoman
Programmer
Hi All,
Another stumper, I think. I'd like to loop through fields once a record is selected.
If I have fields named Cri1, Cri2, Cri3 etc up until Cri15, how can I loop between them dynamically?
For example, if I was analyzing just those three (Cri1, Cri2, and Cri3), Id rather do something like this
Code:
SCAN
IF !DELETED() then
WITH thisform.nsavedSC
.AddItem(cstrptnam)
for x = 1 to 3
IF !EMPTY(cri + x)
.AddListItem((cri + x), .NewIndex, x+1)
ENDIF
endfor
ENDWITH
ENDIF
ENDSCAN
Rather than how I think I'll have to do it. . .
Code:
SCAN
IF !DELETED() then
WITH thisform.nsavedSC
.AddItem(cstrptnam)
if !EMPTY(cri1)
.AddListItem(cri1, .NewIndex, 2)
endif
if !EMPTY(cri2)
.AddListItem(cri2, .NewIndex, 3)
endif
if !EMPTY(cri3)
.AddListItem(cri3, .NewIndex, 4)
endif
*!* Ad infinitum. . .
ENDWITH
ENDIF
ENDSCAN
Some languages allow this type of thing using EVALUATE or INDIRECT type functions. Thoughts?
Thanks great ones!
Dan