cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Neo
Neo
Level VII

How to concatenate rows in a given column to a string in JSL?

If I have a datatable dt with one column col1 and several rows containing characters e.g. a, b, c, d i.e. one character per row. How do I get a string of the form myString = 'a','b', 'c', 'd' ?

 

If I do this

 

 

x = Associative Array( dt:"col1" ) << Get Keys; show (x);

it gives me

 

 

x = {"a", "b", "c", "d"};

whereas I would like to get a string 

myString = 'a', 'b', 'c', 'd'

to use further in my next line of code.

 

Any directions would be helpful.

 

Thanks.

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to concatenate rows in a given column to a string in JSL?

Use Concat Items after you have the list

Names Default To Here(1);

x = {"a", "b", "c", "d"};

my_string = "'" || Concat Items(x, "','") ||"'";

Write(my_string); // 'a','b','c','d'

 

 

 

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to concatenate rows in a given column to a string in JSL?

Use Concat Items after you have the list

Names Default To Here(1);

x = {"a", "b", "c", "d"};

my_string = "'" || Concat Items(x, "','") ||"'";

Write(my_string); // 'a','b','c','d'

 

 

 

 

-Jarmo

Recommended Articles