Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting column names of datawindow

Status
Not open for further replies.

markv105

Programmer
Aug 8, 2002
11
CA
I was using dw_1.SetColumn(li_column) and
dw_1.GetColumnName() with no luck. I don't think
SetColumn works properly.

Does anyone know of another way?

Thanks!
 
OK people, I figured this out. SetColumn() only works when the columns are visible and not protected, which some of mine were. If check the following:

ls_column_name = dw_1.Describe("#"+String(li_column+".name")
li_protected = Integer(dw_1.Describe("#"+String(li_column)+".protect"))
li_visible = Integer(dw_1.Describe("#"+String(li_column)+".Visible"))

And then check li_protected and li_visible, you will get the right results.
 
Hi,

If you want to get the names of all columns in a dw, here is the script to populate a string array with the names of all columns inside a dw regardless of the columns that are visible/protected or not.

//////////////////////////////////////////////////////////
integer li_Count, li_Col ;
string ls_Cols[] ;
//
li_Count = Integer( dw.Object.DataWindow.Column.Count ) ;
//
FOR li_Col = 1 TO li_Count
//
ls_Cols[ li_Col ] = dw.Describe( "#" + String( li_Col ) + ".Name" )
//
NEXT ;
//////////////////////////////////////////////////////////

Regards,

--
PowerObject!
-----------------------------------------
PowerBuilder/PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top