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!

dwc.Retrieve not working after SetFilter()

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
I have a datawindow where I'm using the setfilter() function after I retrieve the rows.

I situation is as follows:

When the window is first opened it retrieves the rows based on default parameters. If the user wants to change the result set, there are options to change the parameters for the datawindow retrieve on the window. Once the user changes the parameters, the user clicks on a button that will re-retrieve the data based on the new parameters. The code behind the retrieve is as follows:

1. retrieve the data
2. for each row retrieved, I calculate a value and do a setitem for a field on each row.
3. call the setfilter() and filter() functions for the datawindow.

The first time the user clicks on the 'retrieve' button on the window, everything works fine. Rows are retrieved and the proper filter is executed.

However, if the user clicks on the retrieve a second time, without changing any of the parameters, the retrieve() function returns 0(zero) rows.

Why would this happen? I don't understand why no rows would get returned.

Keith
 
Hello..
After setfilter()and filter() you have to use setfilter(null variable) and again filter() for to show all records..
example:-
String null_str
SetNull(null_str)
dw_1.SetFilter(null_str)
dw_1.Filter()

One quest..Why you use Setitem instead of Computed Fileds?

Regards..
JERO

 
Hi,

I tried this , but it brought up the Filter dialog box, which I do not want. Also, it still cleared out the datawindow. Any more suggestions?

Keith
 
Debug time...

Comment out all filter processing to see if the filter is causing the problem. (I'm guessing it isn't)

Make sure the datawindow data source (SQL or STP) is executing.

Make sure the datawindow data source should be returning data (trap SQL and run outside of datawindow and app).

HTH
 
I commented out the filter and the retrieve does work and retrieves the rows. As soon as I put the filter back in, the retrieve returns 0 (zero) rows. I checked the SQLCA object and I'm not getting an error.

I'm not understanding what is happening with the Filter. Or maybe something else is causing this? Does anyone else have ideas?

Keith
 
If you take out the filter and it works, and with the filter it doesn't work, then I'd say the filter is the problem. Are you sure the filter is EXACTLY what you are expecting it to be?

Keep the SetFilter but comment out the Filter and instead display the filter string. Make sure its the correct syntax and what you really want to filter.

Run the datawindow outside the application and test the filter string there.
 
I wound up changing the DWO to have computed fields and everything works fine now with the filter.

Does anyone know why it still doesn't work by doing the setitem after the retrieve as I stated in my initial thread?



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top