cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

How do combine numbers in a column with other literals to form text characters?

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
ar = dt << GetAsMatrix( {4} );

txt1 = "abc=" || Char( ar );

I use the above code does not match, much []

2022-08-07_22-14-57.png

 

What I need is the following result:

Thanks!

 

 


txt1 = "abc=59, 61, 55, 66, 52, 60, 61, 51, 60, 61, 56, 65, 63, 58, 59, 61, 62, 65, 63, 62, 63, 64, 65, 64, 68, 64, 69, 62, 64, 67, 65, 66, 62, 66, 65, 60, 68, 62, 68, 70"

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller
Super User (Alumni)

Re: How do combine numbers in a column with other literals to form text characters?

If you know it's just going to be a matrix, you could just lop off the []. 

 

txt1 = "abc=" || Substitute(Char( ar ), "[", "", "]", "");
Vince Faller - Predictum

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How do combine numbers in a column with other literals to form text characters?

Apparently the JSL parser is forcing the numerics into a matrix.  I suggest you turn the issue into JMP support for their feedback.  In the mean time, here is a workaround:

names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
ar = dt << GetAsMatrix( 4 );

txt1 = "abc=" || char(ar[1]);
for(i=2,i<=nitems(ar), i++,
	txt1 = txt1 || ", " || char(ar[i])
);
show(txt1);
Jim
lala
Level VII

Re: How do combine numbers in a column with other literals to form text characters?

Thank Jim!

2022-08-08_07-23-40.png

vince_faller
Super User (Alumni)

Re: How do combine numbers in a column with other literals to form text characters?

If you know it's just going to be a matrix, you could just lop off the []. 

 

txt1 = "abc=" || Substitute(Char( ar ), "[", "", "]", "");
Vince Faller - Predictum