I have a form that has several controls used to allow users to enter in search criteria. I build a WHERE clause based on what is entered by the user. Example below:
lcPermitSearch='' &&Holds final WHERE clause
**parcel search
IF !EMPTY(THISFORM.txtparcel.value)
lcwork = "parcel='"+ALLTRIM(THISFORM.txtparcel.value)+"'"
lcPermitSearch = IIF( EMPTY(lcPermitSearch), ;
' WHERE '+lcwork, ;
lcPermitSearch + ' AND '+lcwork)
ENDIF
**Address search
IF !EMPTY(THISFORM.txtaddress.value)
lcwork = "situs_addr='"+ALLTRIM(THISFORM.txtaddress.value)+"'"
lcPermitSearch = IIF( EMPTY(lcPermitSearch), ;
' WHERE '+lcwork, ;
lcPermitSearch + ' AND '+lcwork)
ENDIF
lcPermitSearch = lcPermitSearch +' ' &&This is my final WHERE clause
**********************************************************************
In the past I've run the resultant data to a cursor because this data was not
to be updated. Now, I want to update the resultant data and would like to create a view here instead of the cursor. My question is, if my WHERE clause can constantly change based on user entries, how should a VIEW be constructed.
In other words, I issue a CREATE SQL VIEW myview AS ; based on user#1 who filled in only (3) of the (8) text boxes that will make up the where clause of the view. Another user fills in different text boxes which will alter the WHERE clause. I guess since I dont know what the WHERE clause will end up being, I don't know how to handle incorporating a view here. I looked at parameterized views but again I still don't know which fields to place in the WHERE clause until the user finishes filling in the search form text boxes.
Any guidance is appreciated.
Thanks.
John.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only