Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building a WHERE clause
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00166558
Message ID:
00166713
Views:
29
OK, here's what I just came up with. I know there is some slop in it, but it seems to work OK. Let me know what you think.

lcWhere = ""
lnElements = 4
DIMENSION laFilter[lnElements]

laFilter[1] = "1"
laFilter[2] = "2"
laFilter[3] = "3"
laFilter[4] = ""

lcWhere = ""
llAnother = .F.

FOR lnCurrent = lnElements to 1 STEP -1
IF !EMPTY(laFilter[lnCurrent])
FOR lnNext = lnCurrent to 1 STEP -1
IF !EMPTY(laFilter[lnCurrent])
llAnother = .T.
ENDIF
NEXT
IF llAnother
laFilter[lnCurrent] = " AND " + laFilter[lnCurrent]
llAnother = .F.
ENDIF
ENDIF
lcWhere = lcWhere + laFilter[lnCurrent]
NEXT
IF LEFT[lcWhere,4] = " AND"
lcWhere = RIGHT(lcWhere,LEN(lcWhere)-4)
ENDIF

?"Where: " +lcWhere
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform