kokosal73
asked on
Filter() result doesn't reflect table contents
I would like to control the content of child data window - dwc.
I do not have the retrieval arguments in the dwc. I do it by SetFilter() and Filter() function.
It works correctly unless there are no records meeting the filter conditions.
In such case I get all records though I should get none.
What am I doing wrong ?
-------------------------- ----------
My piece of code:
-------------------------- ----------
dw_1.settransobject (sqlca)
dw_1.getchild ("zprstate", dwc)
dwc.settransobject (sqlca)
dwc.Reset()
kraj = dw_1.GetItemString (1, "zprcntry")
if not IsNull (kraj) and kraj <> "" then
s_filter = "CNTRY = '" + kraj + "'"
ret = dwc.SetFilter (s_filter)
ret = dwc.Filter()
ret = dwc.AcceptText()
ret = dwc.Retrieve ()
end if
Please help
Koko
I do not have the retrieval arguments in the dwc. I do it by SetFilter() and Filter() function.
It works correctly unless there are no records meeting the filter conditions.
In such case I get all records though I should get none.
What am I doing wrong ?
--------------------------
My piece of code:
--------------------------
dw_1.settransobject (sqlca)
dw_1.getchild ("zprstate", dwc)
dwc.settransobject (sqlca)
dwc.Reset()
kraj = dw_1.GetItemString (1, "zprcntry")
if not IsNull (kraj) and kraj <> "" then
s_filter = "CNTRY = '" + kraj + "'"
ret = dwc.SetFilter (s_filter)
ret = dwc.Filter()
ret = dwc.AcceptText()
ret = dwc.Retrieve ()
end if
Please help
Koko
ASKER
Both functions SetFilter() and Filter() return 1. I tried what you suggested - still does not work.
You might have been using Filter on the same DWC continuosly.
Clear the Filter by using
dwc.SetFilter("")
dwc.Filter()
Then try again by setting the Filter
Loks
Clear the Filter by using
dwc.SetFilter("")
dwc.Filter()
Then try again by setting the Filter
Loks
Are you sure of the contents of CNTRY field?
Add it to the visible column of the dddw and add a MessageBox that show the s_filter contents
Add it to the visible column of the dddw and add a MessageBox that show the s_filter contents
ASKER
I tried that before. Does not work.
I guess it may be the problem with redrawal. Each time when I do dwc.rowcount() after dwc.Retrieve() I get the right number of records, but when it is zero I see them all.
I guess it may be the problem with redrawal. Each time when I do dwc.rowcount() after dwc.Retrieve() I get the right number of records, but when it is zero I see them all.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
DaniPro's solution with putting a dummy row helped, but there also should be dwc.Retrieve() added. Otherwise it does not work. Thanks for your help.
ASKER
DaniPro's solution with putting a dummy row helped, but there also should be dwc.Retrieve() added. Otherwise it does not work. Thanks for your help.
dw_1.settransobject (sqlca)
dw_1.getchild ("zprstate", dwc)
dwc.settransobject (sqlca)
kraj = dw_1.GetItemString (1, "zprcntry")
if not IsNull (kraj) and kraj <> "" then
s_filter = "CNTRY = '" + kraj + "'"
ret = dwc.SetFilter (s_filter)
ret = dwc.Filter()
end if
If dosn't work you can put a MessageBox for verify the result of the SetFilter and Filter function