Solved

Filter out an item from a dropdowndatawindow

Posted on 2001-07-26
7
390 Views
Last Modified: 2013-12-26
I have a dropdowndatawindow that is used within other datawindows.  It is a list of all countries.  How do I filter out "United States of America" if I want to list only foreign countries in the dropdowndatawindow to display?
0
Comment
Question by:aorita
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Accepted Solution

by:
Bhatti earned 200 total points
ID: 6324468
In your DDDW (DropDownDataWindow) select the retrieval argument from menu in datawindow painter SQL and give the retrieval argument , retrieve the countries where country <> 'United States of America'  or the number if you have a number for United States of America.
 (In WHERE retrieval argument column <> United States of America) //Hard codding

You can also put a vriable but always enter the variable in the dddw retrieve( United States of America) as retrieval parameter to avoid from retrieval argument dialogbox.

string                        ls_fcountry
datawindowchild    ldwc_child


dw_1.GetChild("columnname", ldwc_child)
ldwc_child.SetTransObject(sqlca)
ls_fcountry = "United States of America"
ldwc_child.retrieve(ls_fcountry)

//You declared in the datawindow painter SQL retrieval argument as string and in WHERE clause you wrote
//column <> :variable

If not help will write you other function.
0
 
LVL 4

Expert Comment

by:Bhatti
ID: 6325886
It is also good to practice the SetFilter() and Filter() function to use the filter your required data.

string                        ls_fcountry, ls_filter
datawindowchild    ldwc_child


dw_1.GetChild("columnname", ldwc_child)
ldwc_child.SetTransObject(sqlca)
ls_fcountry = "United States of America"
ls_filter = "columnname<> ' " + ls_fcountry + "'"

ldwc_child.SetFilter(ls_filter")
ldwc_child.Filter()


0
 
LVL 4

Expert Comment

by:Bhatti
ID: 6325899
Sorry I forgot, First use the Retrieve() function ldwc_child.retrieve(), without parameter and then use the Setfilter() and filter() functions.
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 4

Expert Comment

by:Bhatti
ID: 6344116
If this did not help you what I wrote above, we have another way also.

datawindowchild ldwc_child
datastore lds_ds //datastore for the list of countries
string ls_fcountry

lds_ds = create datastore
lds_ds.dataobject = 'd_datawindow_name'                        //name of the datawindow for you datastore
lds_ds.SetTransObject(SQLCA)
lds_ds.Retrieve()                                   //retrieve you all countries

ls_fcountry = "United States of America"
lds_ds.SetFilter(ls_fcountry)
lds_ds.Filter() //filter you your country

dw_1.GetChild("columnname", ldwc_child)
ldwc_child.SetTransObject(SQLCA)

ldwc_child.ReSet() //better for next call
lds_ds.RowsMove(1, lds_ds.RowCount(), Primary!, ldwc_child, 1, Primary!)

I do not know where you are writing you code. But in this way you will get always filtered data in
datawindowchild.

0
 
LVL 1

Expert Comment

by:levr
ID: 6346790

If the DataWindow is used in other places as well,
I think it is better not to alter DataWindow, but just delete unwanted data.

datawindowchild    ldchld
long ll_row

dw_1.GetChild("columnname", ldchld)
ldchld.Retrieve()
ll_row = ldchld.Find("country_name = 'United States of America'",1, ldchld.RowCount())
if ii_row > 0 then ldchld.DeleteRow(ll_row)

The code could be put in the window's open event.
Thanks, Lev
0
 

Expert Comment

by:darrelljude
ID: 6382419
I think to have a little flexibility, by adding a
messagebox before the filter.

On the datawindow control where the dd datawindow is
located in the "itemfocuschanged" event put this code

string lx_str
datawindowchild lx_dwchild
long lx_choice


choose case getcolumnname()
     case 'country_from'
          getchild('country_from',lx_dwchild)
          lx_choice = messagebox("Country List From Filter","Exclude United States?",Question!,YesNo!)
          if lx_choice = 1 then
             lx_dwchild.setfilter("trim(country) <> " + "'US'")
             lx_dwchild.filter()
         else

             lx_dwchild.setfilter("")
             lx_dwchild.filter()


          end if
         
      case 'country_to'
          getchild('country_to',lx_dwchild)
          lx_choice = messagebox("Country List To Filter","Exclude United States?",Question!,YesNo!)
          if lx_choice = 1 then
             lx_dwchild.setfilter("trim(country) <> " + "'US'")
             lx_dwchild.filter()
          else

             lx_dwchild.setfilter("")
             lx_dwchild.filter()


          end if
end choose
0
 

Expert Comment

by:kokan
ID: 6396031
aorita,

Please explain more on your question.  The answer seems too trivial.

kokan
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

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: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

615 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