That would be something like
Code:
FOR i=1 TO tf_1.lastrow DO
FOR j=1 TO 40 DO
attrname = 's'+varchar(j);
tf_1[i].GetAttribute(:attrname = BYREF(myvaluevar));
IF myvaluevar=1 THEN
// ... do somthing ....
ENDIF;
ENDFOR;
ENDFOR;
You could of course also use dynamic expressions, or a loop with continuous Find() invocations for all 40 columns - probably the fastest of the given options.