Let's say I have a table "dt" where column names are meaningless.
And I have a table "dt_source" with two columns - one column meaningless name and the other has corresponding meaningful name.
I'm trying to write a script that would rename columns from meaningless to meaningful.
Columns might be different, so I'm going to create a master table "dt_source" with corresponding values.
Now I have a script ready that takes meaningless and leaningful names from a list withing the script and renames colums for each pair if such meaningless name exists.
I want to be able to take those corresponding pairs not from typed in list:
name_in={"col1", "col2"};
name_out={"Age", "Height")
but from a table.
How do I read dt_name_source into two lists: name_in and name_out?
So far I have this:
Names Default To Here(1);
Try(dt_source = Data Table("NameChanging.jmp"), Throw("Trying to open data table"));
If( Not( Is Scriptable( dt_source ) ),
dt_source = Open( "NameChanging.jmp" ), dt_source = Data Table("NameChanging.jmp");
);
Current Data Table(dt_source);
name_in=List();
name_out=List();
col_name_in=Column("name_in");
col_name_out=Column("name_out");
i=0;
For Each Row(name_in[i]=col_name_in[]; name_out[i]=col_name_out[]; i++);
But then it doesn't like it:
Subscript problem{1} in access or evaluation of 'Assign' , name_in = /*###*/col_name_in[] /*###*/
If I try just a variable
For Each Row(name_in=col_name_in[]; name_out=col_name_out[]);
Then it's OK, but it's just one variable taking different values as the cycle goes.
And I need a list.
Can somebody give an idea how to handle this?
Thanks!