INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Show all data from a table in datawindow using DDDW custom ALL selection

Show all data from a table in datawindow using DDDW custom ALL selection

Show all data from a table in datawindow using DDDW custom ALL selection

(OP)
Hi guys,

i have created in powerbuilder a dropdown data window to function as a filter to get values from a table named product and then by selecting smthng from the dropdown list in another datawindow to show all the retrieved data associated with the selection from the dropdown list.

Its working fine, the code in my w_firstwindow in open() is like that

datawindowchild child_data
dw_prod_filter.insertrow(0)
if dw_prod_filter.getchild( 'productname', child_data ) = 1 then
child_data.settransobject( SQLCA )
child_data.retrieve( )
child_data.insertrow(1)
child_data.setitem( 1, 'name', 'ALL' )
child_data.setitem( 1, 'picture_name', 'ALL' )
child_data.selectrow( 0, false )
end if

in the datawindow filter dw_prod_filter in the itemchanged() i have this

string ls_product

ls_product = dw_prod_filter.GetItemString(row,'productname')

dw_product_list.retrieve( data )

and in the dw_product_list in the constructor() i have this

this.setTransObject( SQLCA )

i have made and the necessary retrieval arguments through power builder and is working fine.

BUT,

i want when i select the ALL option from the dropdown list to retrieve the whole table product, i have tried many things with no luck,, and i was wondering if anyone can help me out, any help would be really appreciated,

Thank you in advance guys

RE: Show all data from a table in datawindow using DDDW custom ALL selection

Firstly, I would create an event do do the processing you currently have in the itemchanged event. The event should have the row number as a parameter. You can then POST a call to this event from itemchanged. This way the users entry (what is called 'data') is accepted into the datawindow and can be used in subsequent methods. You can use it in the new event via a 'getitemstring' call using the passed row number and the column name (you called it 'productname' in your example).

The issue you have is in sql you are sending the string 'ALL' as the retrieval argument. You will have to have logic in the sql making up the datawindow to account for the value 'ALL'. Example: of the sql is

SELECT name, id FROM product WHERE name = :name;

you need to change it to something like

SELECT name, id FROM product WHERE CASE :name = 'ALL' THEN 1 = 1 ELSE name = :name END;

SQL CASE statements can vary by dbms so you should look up the proper one for your situation.

Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close