Dropdown list in PowerBuilder can't retrieve all data

时间:2015-11-12 10:50:38

标签: powerbuilder datawindow

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 something 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

2 个答案:

答案 0 :(得分:1)

dw_product_list的SQL语句是什么样的 - 特别是WHERE子句?

-Paul -

答案 1 :(得分:0)

示例:

在itemchanged()

string ls_product
ls_product = dw_prod_filter.GetItemString(row,'productname')
dw_product_list.retrieve( ls_product )

在SELECT中:

SELECT "product"."id", "product"."name", "product"."description", "product"."prod_size", "product"."color", "product"."quantity", "product"."unit_price", "product"."picture_name" FROM "product" WHERE ( "product"."name" = :name OR "product"."name" is null )