Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jackhertel
Contributor III
Contributor III

For - Next parameter using variables?

Can I use a variable, expression or a Peek for the constraints in a For Next

i.e. For 1 to vCounterMax or

For 1 to peek(Column, 0)

to define a loop.  It does not seem to resolve either case.

5 Replies
jackhertel
Contributor III
Contributor III
Author

I suppose I should write these with the correct format

For i=1 to vCounterMax

or

For i=1 to peek(Column, 0)

Anil_Babu_Samineni

Perhaps this?

For i=1 to Peek('Column',0, 'Table')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jackhertel
Contributor III
Contributor III
Author

Thank you Aniil,

But no luck.  It does not seem to try to resole the Peek or a Variable at all.

I get an error message window that has:

Syntax error

For i  = 1 to >>>>>><<<<<<

The part following the 'to' does not seem to get resolved to a number.

swuehl
MVP
MVP

Both worked for me:

Let vCounterMax = Peek('Field',0,'Table');

For i = 1 to vCounterMax

TRACE $(i);

Next

or

For i = 1 to Peek('Field',0,'Table')

TRACE $(i);

Next

If you are using the variable approach, what does a TRACE of your variable show?

Anil_Babu_Samineni

The only thing, I can think about your Peek() may stores String which 1 to Some String which is false? Can you screenshot the image of Trace as Stefan said?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful