Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameterized View
Message
From
06/11/1997 16:38:17
 
 
To
06/11/1997 16:22:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00058732
Message ID:
00058737
Views:
29
>With the view parameters set as follows:
>
>vp_Active = .T.
>vp_idnum = '*'
>vp_last = 'A%'
>vp_first = '*'
>vp_middle = '*'
>
>shouldn't the following view definition return only records that have
>lastname beginning with 'A' and empty(disdate)?   It doesn't - it returns
>records that have lastname beginning with 'A' regardless of disdate.
>Am I missing something simple?
>
>SELECT Clients.cidnum, Clients.clastname, Clients.cfirstname,;
>  Clients.cmiddlename, Clients.cadmdate, Clients.disdate;
>FROM cms!clients;
>WHERE Clients.cidnum LIKE ?vp_idnum;
>   OR (UPPER(Clients.clastname) LIKE UPPER(?vp_last));
>   OR (UPPER(Clients.cfirstname) LIKE UPPER(?vp_first));
>   OR (UPPER(Clients.cmiddlename) LIKE UPPER(?vp_middle);
>   AND EMPTY(Clients.disdate) = ?vp_active)

Try adding EMPTY(clients.disdate) to the SELECT clause. What I think is happening, is that (especially if the table is already open before yoiu run the query) the query looks at the value of empty(clients.disdate) for the record that the pointer is on when you run the query. Since it is .T., it pulls all the records. Effectively like saying WHERE .T..

Another thing to try that, come to think of it is more likely the problem: Put a pair of parentheses around all of the OR parameters to clarify that it can meet any one of THESE requirements AND be empty. If you ar eusing the view designer, I'm not sure how to do this, but to verify if this is what is happening, you can cut and paste the code into the command window, replace the parameters with test values, and run. Try it both ways and compare the results.
HTH
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform