Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I shorten code this?
Message
De
07/01/2000 15:48:30
 
 
À
07/01/2000 10:45:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00314481
Message ID:
00314721
Vues:
28
>
lnNbFields = AFields(laStruct, "MyTable")
>llFound = .F.
>lnI = 1
>
>DO WHILE (lnI <= lnNbFields) AND NOT llFound
>   llFound = Evaluate(laStruct[lnI, 1]) = "Y"

Danger Will Robinson!  You've gone and assumed that all fields are a character type...at least check TYPE(laStruct[lnI,1]) to make sure it's "C"

Also, since the count of fields is finite, I'd probably use a FOR...NEXT loop.

>   lnI = lnI + 1
>ENDDO
>
>IF llFound
>   *-- Do whatever
>ENDIF
HTH
>I am looking for a shortcut way to do this.
>>Thanks in advance and then some.
>>
>>IF mytable.my_field1 = "Y" OR ;
>> mytable.my_field2 = "Y" OR ;
>> mytable.my_field3 = "Y" OR ;
>> mytable.my_field4 = "Y" OR ;
>> mytable.my_field5 = "Y" OR ;
>> ...(do whatever)
>>ENDIF
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform