dc03kks
dc03kks

Reputation: 221

Avoid duplicates in dddw in powerbuilder

i have a created a DropDownDataWindow in PowerBuilder, the list has zip codes from a database table... but it has many duplicates and more like that for example,

01720
01720
01720
01730
01730
01730   
01730

... ans so on ,

my script is the following

datawindowchild child_data

dw_zipcontact_filter.insertrow(0)
if dw_zipcontact_filter.getchild( 'zipcontact', child_data ) = 1 then
 child_data.settransobject( SQLCA )
 child_data.retrieve( ) 
 child_data.insertrow(1)
 child_data.setitem( 1, 'id', 'ALL zip codes' )
 child_data.setitem( 1, 'zip', 'ALL zip codes' )
 child_data.selectrow( 0, false )   
end if

i want to show my list like that,

01720
01730

.... and so on,

how can i do that?? i was wondering if anyone can help me, any help would be really appreciated..

Thank you in advance

Upvotes: 1

Views: 778

Answers (2)

dc03kks
dc03kks

Reputation: 221

With the great help of Matt Balent, i solved it and here is the solution analytically,

Open the DDDW's DataWindow Painter. Go to the SQL source. Under the Design menu, select "Convert to Syntax" if you're not already there, and either use the SELECT DISTINCT clause or a GROUP BY clause.,

Upvotes: 0

Matt Balent
Matt Balent

Reputation: 2397

You need to create the SELECT statement for the datawindow object used as the DDDW in your 'zipcontent' column to only retrieve a distinct list. You should also set the sort order (either in the SQL itself or in the sort option of the datawindow object).

Upvotes: 1

Related Questions