cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Bryan
Level I

Rename column using first row's value

Hi

 

I'm trying to name my column names based on the string word in the first row of every other column as per described in the picture.

 

Capture.PNG

 

 

My script can't seem to work. I am finding a way to get the string value in the first row but doesn't seem to work. Can you help me out?

 

dt = Current Data Table();

newname = dt << select rows (1) << print ;

For( i = 2, i <= N Cols( dt ), i=i+2,

Column( dt, i+1 ) << Set Name( newname );

);

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Rename column using first row's value

Try this script:

 

Names Default to Here( 1 );

dt = Current Data Table()

For( c = 2, c < N Col( dt ), c += 2,
	Column( dt, c+1 ) << Set Name( Column( dt, c )[1] );
);

View solution in original post

1 REPLY 1

Re: Rename column using first row's value

Try this script:

 

Names Default to Here( 1 );

dt = Current Data Table()

For( c = 2, c < N Col( dt ), c += 2,
	Column( dt, c+1 ) << Set Name( Column( dt, c )[1] );
);