Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FOR ... ENDFOR loop
Message
De
04/09/2001 18:40:11
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
04/09/2001 13:30:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00552168
Message ID:
00552220
Vues:
14
>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?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform