<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Concatenate table values into a string variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83178#M37449</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/13311"&gt;@RonSwanson&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Just make sure the column name is spelled correctly. Preferrably delete the space in the name of the column.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Nov 2018 19:20:18 GMT</pubDate>
    <dc:creator>uday_guntupalli</dc:creator>
    <dc:date>2018-11-13T19:20:18Z</dc:date>
    <item>
      <title>Concatenate table values into a string variable</title>
      <link>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83122#M37436</link>
      <description>&lt;P&gt;I have a table of characters and want to produce a string variable of the concatenated values of each column to use as the argument of a function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's say this is my table of data:&lt;/P&gt;&lt;P&gt;Column1 Column2&lt;/P&gt;&lt;P&gt;Item1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value1&lt;/P&gt;&lt;P&gt;Item2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value2&lt;/P&gt;&lt;P&gt;Item3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value3&lt;/P&gt;&lt;P&gt;Item4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value4&lt;/P&gt;&lt;P&gt;Item5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value5&lt;/P&gt;&lt;P&gt;&amp;nbsp;. . .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;. . .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table will have 2 columns but any number of rows. The output I'm looking for is this:&lt;/P&gt;&lt;P&gt;strColumn1 = 'Item1','Item2','Item3','Item4','Item5'&lt;/P&gt;&lt;P&gt;strColumn2 = 'Value1','Value2','Value3','Value4','Value5'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help much appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 15:49:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83122#M37436</guid>
      <dc:creator>RonSwanson</dc:creator>
      <dc:date>2018-11-13T15:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate table values into a string variable</title>
      <link>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83123#M37437</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/13311"&gt;@RonSwanson&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Maybe something like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table(); 

Col1Vals = dt:Column 1 &amp;lt;&amp;lt; get Values; 
Col2Vals = dt:Column 2 &amp;lt;&amp;lt; get Values; 

// If you are specific about how the output looks, you can try the following, else 
// the above lines should give you what you want 
Str1 = "";
Str2 = ""; 

for(i = 1, i &amp;lt;= N Items(Col1Vals), i++,
		If(i == 1,
				Str1 = Str1 || Col1Vals[i];
				Str2 = Str2 || Col2Vals[i];
				,
				//else 
				Str1 = Str1 || "," || Col1Vals[i];
				Str2 = Str2 ||  "," ||Col2Vals[i];
		  );

   );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Nov 2018 15:57:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83123#M37437</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-11-13T15:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate table values into a string variable</title>
      <link>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83124#M37438</link>
      <description>&lt;P&gt;The Col1Vals command worked, however, got the following error when using the Col2Vals command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Col2Vals &lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dt&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;:&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;Column 2 &lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; get Values&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Scoped data table access requires a data table column or variable in access or evaluation of 'dt:Column 2' , dt:Column 2&lt;/P&gt;&lt;P&gt;In the following script, error marked by /*###*/&lt;/P&gt;&lt;P&gt;Col2Vals = dt:Column 2 &amp;lt;&amp;lt; get Values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 16:04:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83124#M37438</guid>
      <dc:creator>RonSwanson</dc:creator>
      <dc:date>2018-11-13T16:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate table values into a string variable</title>
      <link>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83168#M37445</link>
      <description>&lt;P&gt;Looks like you're trying to create an SQL IN list.&amp;nbsp; Here's another approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Untitled 81", Add Rows( 2 ),
	New Column( "Column 1", Character, "Nominal", Set Values( {"Item1", "Item2"} ) ),
	New Column( "Column 2", Character, "Nominal", Set Values( {"Value1", "Value2"} ) )
);
col1_list = column(dt, "Column 1") &amp;lt;&amp;lt; get values;
col2_list = column(dt, "Column 2") &amp;lt;&amp;lt; get values;
strcolumn1 = "('" || concat items(col1_list, "','") || "')";
strcolumn2 = "('" || concat items(col2_list, "','") || "')";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If any of the columns are numeric then the list returned from get values will be a matrix, and you will need to loop over the matrix to convert all elements to strings.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 18:10:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83168#M37445</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-11-13T18:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate table values into a string variable</title>
      <link>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83178#M37449</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/13311"&gt;@RonSwanson&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Just make sure the column name is spelled correctly. Preferrably delete the space in the name of the column.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 19:20:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Concatenate-table-values-into-a-string-variable/m-p/83178#M37449</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-11-13T19:20:18Z</dc:date>
    </item>
  </channel>
</rss>

