Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a WHERE clause
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00166558
Message ID:
00166759
Vues:
19
>
> Ah, I just reread your message. My routine will have the same problem. Time to rethink it.

OK, here's what I've got. I think this one works much better
lcWhere = ""
lnElements = 4
llAnother = .F.
DIMENSION laFilter[lnElements,2]

laFilter[1,1] = "view1"
laFilter[1,2] = "1"
laFilter[2,1] = "view2"
laFilter[2,2] = ""
laFilter[3,1] = "view3"
laFilter[3,2] = "3"
laFilter[4,1] = "view4"
laFilter[4,2] = "4"

FOR lnCurrent = lnElements to 1 step -1
    IF !EMPTY(laFilter[lnCurrent,2])
        FOR lnNext = lnElements-1  to 1 step -1
             IF !EMPTY(laFilter[lnNext,2])
                    lcWhere = lcWhere + laFilter[lnCurrent,1] + "=" + laFilter[lnCurrent,2] + " AND "
                    EXIT
             ENDIF
        ENDFOR
    ENDIF
ENDFOR
IF RIGHT(lcWhere,4) = "AND "
  lcWhere = LEFT(lcWhere,LEN(lcWhere)-4)
ENDIF
?"Where: " +lcWhere
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform