cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
axcelenator1
Level III

Problem with grouping columns

Hello, I have some JSL code which includes double loop and a the end of the code includes a line which i want to group the columns but it doesn't do that. 

 

1. How can I fix the code?

2. When running the script is any way that the new table opens will be another one and not the original table? I mean I want another file will be opened..

The code and table are attached:

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))
);




1 ACCEPTED SOLUTION

Accepted Solutions
axcelenator1
Level III

Re: Problem with grouping columns

I found the problem: The problem is that I've tried to concatenate a "string" with an : operator. This is not possible. The way to do it is:

g_list[j] = dt << Group Columns(:(test_list[j] || "_" || s_list[1]), Length(s_list));

View solution in original post

1 REPLY 1
axcelenator1
Level III

Re: Problem with grouping columns

I found the problem: The problem is that I've tried to concatenate a "string" with an : operator. This is not possible. The way to do it is:

g_list[j] = dt << Group Columns(:(test_list[j] || "_" || s_list[1]), Length(s_list));