Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetFilter Not Working?

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
I'm using MSSQL Server and PB6.5.

I have a window where the user can select multiple criteria and retrieve their results. If I select no criteria and then click my retrieve button. row are returned. Let's say now I want to filter the result set now. I select anyone of my parameters that I know would return 0(zero) rows. I go ahead and select that parameter and click the retrieve button. Zero rows are returned at this time. So, far everything is working the way I expect it to be. Now, I deselect my parameter, so at this point no parameters are selected. I click the retrieve button and no rows are returned. At this point I expect all rows to be returned. The code behind the retrieve button is using the SetFilter() and Filter() functions after the retrieve. When I debug the code no errors are occuring on the filter functions nor on the retrieve.

Here is my second example:
I retrieve with no parameters. Rows are returned. I then select a parameter that I know will return rows. I click the retrieve and it returns rows. I then return to no parameters and click the retrieve and rows are returned.

So, the only time things are not working right is when I first select with no parameters(rows are returned), then I select a parameter I know will not return rows(rows are not returned), then I go back to no parameters(no rows are returned even though rows should be returned).

Does anyone know why the retrieve(at this point no parameters are selected) does not work after I select a parameter that should return now rows? I'm using a RTF type datawindow, if this matters.

Hope I explained my problem clearly.

Keith
 
u shouldn't retrieve all the rows, u should get more information to make the SELECT.

if u want to drop your filter :

dw_1.setfilter('')
dw_1.filter()

Regards
 
the code behind the retrieve button should check whether any parameters are selected or not.
If one or more parameteres are selected, it should set filter accordingly
ELSE remove the filter
dw_1.setfilter('')
dw_1.filter()

BTW, u need to check the return code of setfilter() to make sure that your filter expression is correct or not
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top