to puzzle: #for and successors
Author: i2stiller@gmx.de (istiller)
Hi freaks I want to shift a few databases field by one position like this: FOR v_I = 9 TO 1 STEP -1 @"FLD_%%(v_ID+1)%%%.TBL" = @"FLD_%%v_ID%%%.TBL" ENDFOR Then I thought, hmmm what about a #for instead of FOR, as the number of fields is known a compile time #for c_I = (9,8,7,6,5,4,3,2,1) FLD_<C_I+1>.TBL = FLD_<C_I>.TBL #endfor And you, as an expert, see the problem :-) How to solve this? I got a solution, but with drawbacks With that one, you could also write all assignments line by line without a #for Don't show you my solution not to influence your brain on look out for a general one :-) Ingo

: #for c_1 = (9,8,7,6,5,4,3,2,1),counter #for c_2 = (8,7,6,5,4,3,2,1,0),counter2 #if (<counter>=<counter2>) FLD_<c_1>.TBL = FLD_<c_2>.TBL #endif #endfor #endfor bad because .... generate comment if( counter!=counter2) : [ 4] #for c_1 = (9,8,7,6,5,4,3,2,1),counter [ 5] #for c_2 = (8,7,6,5,4,3,2,1,0),counter2 [ 6] #if (0=0) [ 7] 1 FLD_9.TBL = FLD_8.TBL ------------> OK [ 8] #endif [ 9] #endfor [ 6] #if (0=1) [ 7] ; FLD_9.TBL = FLD_7.TBL -----------> KO but right ? [ 8] #endif [ 9] #endfor [ 6] #if (0=2) [ 7] ; FLD_9.TBL = FLD_6.TBL [ 8] #endif [ 9] #endfor [ 6] #if (0=3) [ 7] ; FLD_9.TBL = FLD_5.TBL [ 8] #endif [ 9] #endfor [ 6] #if (0=4) [ 7] ; FLD_9.TBL = FLD_4.TBL [ 8] #endif [ 9] #endfor .... Gilles.



