Hello,
I have the next code. In the last lines I try to stack some columns. The problem is that when I run the script I see only 1 column stacked although I need to see more than 1(according to the lists length inside the code)
dt = open("C:\JMPCommunity\DataTableExample.jmp"); s_list = {sen1, sen2, sen3, sen4, sen5}; test_list ={test1, test2, test3}; tokens_list={Col1, Col2, Col3}; g_list={g1,g2,g3}; For(j = 1, j<=Length(test_list), j++, For( i = 1, i<= Length(s_list), i++, dt << New Column ( test_list[j] ||"_" || s_list[i], Numeric, Continuous, Formula( Num(Word( i, As Column(Column(tokens_list[j] )), "|" )) ) ) ); g_list[j] = dt << Group Columns(:( || test_list[j]|| "_" || s_list[1]), Length(s_list));
dt << Stack(columns(dt << Get Column Group( g_list[j] );),
Source Label Column( "Label_" || test_list[j] ),
Stacked Data Column( "Data_" || test_list[j])
););
My Qs are:
1. How can the issue be fixed.
2. How can the new opened data table will be a new dt (that is not updated by the original one)?
A dt example is attached
After correcting adding a ':Column(' in the Group Columns( message, the script seems to work except it creates three different tables, each with a single set of grouped columns. If you want to keep adding columns to the newly created table (which is what I think you are wanting), you would need to reference the newly created table. Here is one way to do that:
Names default to here( 1 );
s_list = {sen1, sen2, sen3, sen4, sen5};
test_list ={test1, test2, test3};
tokens_list={Col1, Col2, Col3};
g_list={g1,g2,g3};
dt = list();
dt[1] = open("C:\Users\a384681\Downloads\DataTableExample.jmp");
For(j = 1, j<=Length(test_list), j++,
For( i = 1, i<= Length(s_list), i++,
dt[j] << New Column ( test_list[j] ||"_" || s_list[i],
Numeric,
Continuous,
Formula(
Num(Word( i, As Column(Column(tokens_list[j] )), "|" ))
)
)
);
g_list[j] = dt[j] << Group Columns(:Column(test_list[j] || "_" || s_list[1]), Length(s_list));
dt[j+1] = dt[j] << Stack(
columns(dt[j] << Get Column Group( g_list[j] );),
Source Label Column( "Label_" || test_list[j] ),
Stacked Data Column( "Data_" || test_list[j])
);
);
After correcting adding a ':Column(' in the Group Columns( message, the script seems to work except it creates three different tables, each with a single set of grouped columns. If you want to keep adding columns to the newly created table (which is what I think you are wanting), you would need to reference the newly created table. Here is one way to do that:
Names default to here( 1 );
s_list = {sen1, sen2, sen3, sen4, sen5};
test_list ={test1, test2, test3};
tokens_list={Col1, Col2, Col3};
g_list={g1,g2,g3};
dt = list();
dt[1] = open("C:\Users\a384681\Downloads\DataTableExample.jmp");
For(j = 1, j<=Length(test_list), j++,
For( i = 1, i<= Length(s_list), i++,
dt[j] << New Column ( test_list[j] ||"_" || s_list[i],
Numeric,
Continuous,
Formula(
Num(Word( i, As Column(Column(tokens_list[j] )), "|" ))
)
)
);
g_list[j] = dt[j] << Group Columns(:Column(test_list[j] || "_" || s_list[1]), Length(s_list));
dt[j+1] = dt[j] << Stack(
columns(dt[j] << Get Column Group( g_list[j] );),
Source Label Column( "Label_" || test_list[j] ),
Stacked Data Column( "Data_" || test_list[j])
);
);
Hello,
I think there is a problem. The last table that is opened is generating more rows than needed.
For example: the 1st DT stack is what I need consists 10 rows of data. The last DT includes 250 data cells!!
This is X25. Now, in real if I have a table of 10^6 or more rows Than it will extremely be multiplied and maybe the computer data processing will terminate....
According to the example I've attached I must get 3 stacked columns of Label&Data that is only 10 rows of cells.
I think of MultipleSeriesStack but not sure how to insert it to my code