Filter between two dropdowndata windows

Posted on 2006-05-29
Last Modified: 2013-12-26
I have a window that contains two dropdown datawindows calling from two procedures. I'm using PowerBuilder9

1.Function Desired: function     ( display value  : function_desc, data value : function)     fun1,fun2,fun3,fun4
2.corrected Code  : code_value ( display value : code_desc,      data value : code_value) cod1,cod2,cod3,cod4,cod5 and cod6

I need to filter in the second datawindow according to the first ddw selection.

If the user selects fun1 in drowdown(function desired) then I need to filter the 2nd ddw and shows only cod5,cod2 and cod6.
                           fun2 in drowdown(function desired) then I need to filter the 2nd ddw and shows only cod2.
                            fun3 in drowdown(function desired) then I need to filter the 2nd ddw and shows only cod1
                            fun4 in drowdown(function desired) then I need to filter the 2nd ddw and shows only cod1,cod2 ,cod3 and cod4.
I wrote the code in retreive event( window level) and itemchanged event ( dw level). But I am not able to do filter properly according to their selection.

I appreciate your help.
Question by:venkat4sv
    LVL 14

    Accepted Solution


    it means you want hard coding... and fun1 to 4 and cod1 to 6 are datavalues not display values.
    One more thing... here your main datawindow is tabular or freeform. I mean how many records will be dipslayed at a time. If it's free form and only single record will be displayed at a time following code will work fine. Otherwise you may need to do some workaround for display value. Becoz when you select fun1 in first row and and fun2 in second row it will affect display value of column code_value in both rows.

    say your main datawindow is dw_1. Write code as below

    Instance variable declaration
    datawindowchild idwc_fun, idwc_code

    dw_1.constuctor event


    dw_1.ItemChanged Event

    If This.GetColumnName() = 'function' Then
          Choose Case Data
                Case 'fun1'
                      idw_code.SetFilter("code_value = 'cod5' OR code_value = 'cod2' OR code_value = 'cod6'")
                Case 'fun2'
                      idw_code.SetFilter("code_value = 'cod2'")
                Case 'fun3'
                      idw_code.SetFilter("code_value = 'cod1'")
                Case 'fun4'
                      idw_code.SetFilter("code_value = 'cod1' OR code_value = 'cod2' OR code_value = 'cod3' OR code_value = 'cod4'")
          End Choose
    End If


    Author Comment

    Thank you Sandeep, I got the result.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    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 NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now