Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Filter() result doesn't reflect table contents

Posted on 2003-03-31
8
Medium Priority
?
231 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:kokosal73
  • 4
  • 3
8 Comments
 
LVL 6

Expert Comment

by:DaniPro
ID: 8237765
Try to modify your script:

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
0
 

Author Comment

by:kokosal73
ID: 8237847
Both functions SetFilter() and Filter() return 1. I tried what you suggested - still does not work.
0
 
LVL 3

Expert Comment

by:loks
ID: 8237899
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:DaniPro
ID: 8237932
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
0
 

Author Comment

by:kokosal73
ID: 8238004
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.
0
 
LVL 6

Accepted Solution

by:
DaniPro earned 150 total points
ID: 8238111
Try to modify again your script:

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()
  if dwc.RowCount() = 0 then
    // Put a dummy row into the child datawindow
    child_dddw.Insertrow(0)
  end if
end if


0
 

Author Comment

by:kokosal73
ID: 8238756
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.
0
 

Author Comment

by:kokosal73
ID: 8243823
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.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question