Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a WHERE clause
Message
De
12/12/1998 15:07:15
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00166558
Message ID:
00166910
Vues:
22
>lcWhere = ''
>FOR i=1 TO ALEN(laFilter)
> IF i = 1
> lcWhere = ALLT(laFilter[i])
> ELSE
> IF ! EMPTY(laFilter[i])
> lcWhere = lcWhere + ' AND ' + ALLT(laFilter[i])
> ENDIF
> ENDIF
>NEXT i
>
>Wouldn't something like that work? Obviously you could get more elaborate.
>
>Wayne

My preferred way of dealing with things like this:

lcWhere = ''
lcAnd=""
FOR i=1 TO ALEN(laFilter)
IF ! EMPTY(laFilter[i])
lcWhere = lcWhere + lcAnd + ALLT(laFilter[i])
lcAnd=" and "
ENDIF
NEXT i

Not doing much, just for shorter code and one less nested IF.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform