cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

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

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