<?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: Possible to assign a list of items to part of a column? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618893#M81826</link>
    <description>&lt;P&gt;You can also use functions of lists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

:name &amp;lt;&amp;lt; Set Values(
	Insert(
		(:name &amp;lt;&amp;lt; Get Values),
		{ "name 41", "name42" }
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 31 Mar 2023 19:38:19 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2023-03-31T19:38:19Z</dc:date>
    <item>
      <title>Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618863#M81823</link>
      <description>&lt;P&gt;Hi. &amp;nbsp;I was wondering if there's a clever way to assign or append a list of items to column(s) in an existing table. &amp;nbsp;For example, I have a column of names and I would like to add more names (rows) to the column from a list. &amp;nbsp;The code below was one of my attempts. &amp;nbsp;The problem is that instead of assigning each item in the list to its own row, rows 1-6 are each assigned the entire list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt &amp;lt;&amp;lt; Add Rows(6, At Start);
dt:name[1::6] = {"A", "Very", "Long", "List", "Of", "Items"};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm aware that I could add a list of "column = value" pairs using the &amp;lt;&amp;lt; Add Rows() message, but this requires me to modify my existing column of items from {"item1", "item2", ...} to {column name = "item1", column name = "item2", ....}. &amp;nbsp;Perhaps there's some command that converts the one list format to the other format? &amp;nbsp;I can see no straightforward way to do this that doesn't rely on a For loop. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also have considered just creating a temp table with the same column names, using &amp;lt;&amp;lt; Set Values(list) to populate the columns, and then concatenating to the original table. &amp;nbsp;For various reasons though, I'd prefer not to do it this way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, I considered reading all the original column values back as lists, appending the new list for each column to the originals, and then just writing each entire list back to the original table. &amp;nbsp;Again, not my preferred method as my lists are long. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some other way I could do this? &amp;nbsp;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using JMP Pro 17.0.0 on Mac OS Ventura 13.2.1&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:59:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618863#M81823</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2023-06-10T23:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618882#M81824</link>
      <description>&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;According to &lt;A href="https://community.jmp.com/t5/Uncharted/Data-table-subscripting/ba-p/21013" target="_blank"&gt;Data-table-subscripting&lt;/A&gt;&amp;nbsp;one can use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt[1::6,{name}] = {{"A"}, {"Very"}, {"Long"}, {"List"}, {"Of"},{ "Items"}};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt[1::6,{name,sex}] = {{"A","F"}, {"Very","M"}, {"Long","F"}, {"List","M"}, {"Of","F"},{ "Items","M"}};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For numbers it's just:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt[1::6,{height}] = [6,5,4,3,2,1 ];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 11:21:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618882#M81824</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-04-01T11:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618893#M81826</link>
      <description>&lt;P&gt;You can also use functions of lists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

:name &amp;lt;&amp;lt; Set Values(
	Insert(
		(:name &amp;lt;&amp;lt; Get Values),
		{ "name 41", "name42" }
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2023 19:38:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618893#M81826</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-03-31T19:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618902#M81827</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt &amp;lt;&amp;lt; Add Rows(6, At Start);
dt[1::6, "name"] = {"A", "Very", "Long", "List", "Of", "Items"};&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2023 20:18:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618902#M81827</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2023-03-31T20:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618976#M81838</link>
      <description>&lt;P&gt;Ah, thanks!&lt;BR /&gt;&lt;BR /&gt;interesting:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt[1::6,{name}]; // {{"KATIE"}, {"LOUISE"}, {"JANE"}, {"JACLYN"}, {"LILLIE"}, {"TIM"}}
dt[1::6,"name"]; // {"KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM"} 
dt[1::6,{height}]; // [59, 61, 55, 66, 52, 60]
dt[1::6,"height"]; // [59, 61, 55, 66, 52, 60] (same)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and therefore one needs to write:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt[1::6,{name}] = {{"KATIE"}, {"LOUISE"}, {"JANE"}, {"JACLYN"}, {"LILLIE"}, {"TIM"}}
dt[1::6,"name"] =  {"KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM"}
dt[1::6,"height"]=[1,2,3,4,5,6]
dt[1::6,{height}]=[1,2,3,4,5,6]	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... I didn't know.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 11:56:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618976#M81838</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-04-01T11:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618977#M81839</link>
      <description>&lt;P&gt;You can get what you want by using "Set Values".&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; Add Rows( 6, At Start );
theList = {"A", "Very", "Long", "List", "Of", "Items"};
dt:name &amp;lt;&amp;lt; set values( theList );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Apr 2023 12:28:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/618977#M81839</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-04-01T12:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to assign a list of items to part of a column?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/619827#M81920</link>
      <description>&lt;P&gt;Thanks Vince. &amp;nbsp;I knew there was a way. &amp;nbsp;I like this method the most since I can tailor the code insert values to any row, even if they aren't contiguous:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Try(Close("Big Class.jmp", NoSave));
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; Add Rows( 2, After(2) );
dt &amp;lt;&amp;lt; Add Rows( 2, After(7) );
dt &amp;lt;&amp;lt; Add Rows( 2, After(12) );
dt[[3 4 8 9 13 14], "name"] = {"A", "Very", "Long", "List", "Of", "Items"};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nikles_0-1680621793897.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51707i9069ABEF34337266/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nikles_0-1680621793897.png" alt="nikles_0-1680621793897.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kudos!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 15:23:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-assign-a-list-of-items-to-part-of-a-column/m-p/619827#M81920</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2023-04-04T15:23:47Z</dc:date>
    </item>
  </channel>
</rss>

