Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FOR ... ENDFOR loop
Message
From
04/09/2001 18:40:11
 
 
To
04/09/2001 13:30:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00552168
Message ID:
00552220
Views:
15
>Hi all,
> I have a group of fields, five in all that I need to go through sequentially. I have a for loop that that I thought would do this. They are named note1 through note5. I am trying to use something along the lines of:
>
>FOR i = 1 to 5
> DO CASE
> CASE note(i)
> myCode
> ENDCASE
>ENDFOR

>
>What is wrong with this picture?

Nadya gave you a solution to the problem. But to answer your question about why is that a named expression (the "(i)") isn't valid here. I'm guessing that's what you want with the parens, and not that you're trying to access the notes fields as a collection.

Anyway, you need either EVAL as Nadya showed you, or a macro, as in:
FOR i = 1 to 5
    lc = LTRIM( STR( i ) )
    DO CASE
        CASE note&lc
            myCode
    ENDCASE
ENDFOR
All this assumes these fields are booleans, right?
Previous
Reply
Map
View

Click here to load this message in the networking platform