cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Rename Data Table Script

Aam_jmp
Level IV

I know I can rename a data data table script using dt << Rename Table Script("Old","New"); But I want to rename more than one scripts and I am trying to rename all the scripts starting from the third script in the data table with the column names I acquired from a different table. Can anyone point me out to my mistake since I am getting no error in my log. Thank you. 

 

 

a1 = dt << getTableScriptNames;
show(a1);
names = dt1 << get column names(String);
 
for( i=3, i <= N Items( a1 ), i++,
dt << Rename Table Script(a1,Name);
show(a1);
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
uday_guntupalli
Level VIII


Re: Rename Data Table Script

@Aam_jmp,
        A couple of things, you will need to index into the list of names , not use the list as a whole. 

for(i = 3, i <= N Items(a1), i++,
		dt << Rename Table Script(a1[i],Names[i]); 
   );

 

      Another thing, I would keep in mind is if you are starting from i = 3, Are you sure you want to be naming starting from the 3rd column of dt1 - if yes, the above should work.  

Best
Uday

View solution in original post

4 REPLIES 4
uday_guntupalli
Level VIII


Re: Rename Data Table Script

@Aam_jmp,
        A couple of things, you will need to index into the list of names , not use the list as a whole. 

for(i = 3, i <= N Items(a1), i++,
		dt << Rename Table Script(a1[i],Names[i]); 
   );

 

      Another thing, I would keep in mind is if you are starting from i = 3, Are you sure you want to be naming starting from the 3rd column of dt1 - if yes, the above should work.  

Best
Uday
Aam_jmp
Level IV


Re: Rename Data Table Script

Thanks for the quick response. @uday_guntupalli I realized I missed out on indexing. I want to rename the table scripts beginning the third script, taking the first column name i.e. a[3] = Name[1]. How can I do that?

uday_guntupalli
Level VIII


Re: Rename Data Table Script

@Aam_jmp
     Simplest way I can think of is: 

for(i = 3, i <= N Items(a1), i++,
		dt << Rename Table Script(a1[i],Names[i-2]); 
   );

   However, irrespective of the approach you will need to ensure that as there are sufficient items in Names for you to do this. 

Best
Uday
Aam_jmp
Level IV


Re: Rename Data Table Script

Thank you very much