<?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: Transfer data between tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/580447#M78753</link>
    <description>&lt;P&gt;Solved! Instead of trying to do this with JMP, I just asked someone to modify the SQL query to do this, which is much easier.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2022 19:39:15 GMT</pubDate>
    <dc:creator>StarfruitBob</dc:creator>
    <dc:date>2022-12-12T19:39:15Z</dc:date>
    <item>
      <title>Transfer data between tables</title>
      <link>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/579671#M78693</link>
      <description>&lt;P&gt;Hello, I'm able to pull an SQL table that's in a very simple format. One column has a unique ID (UID) another column has column headers, and the third has a UID. I have another table where certain cells have the same UID. I want to plug the values from the first table ("UID") to the second, new table ("New").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tabulate was the perfect tool to sort the column headers and give me a row count, but because the UID column contains both string and numeric data, I'm unable to directly populate the table with the values through tabulate, so instead I put the UID in for values in the tabulate tool. This at least gave me a way to correlate what value belongs where.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If tabulate can directly populate the actual values (no statistics needed) in place of needing to search for the UID between tables, this would be ideal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Writing pseudocode is easy enough to show what needs to be done, but the JSL I'm not having luck with.&amp;nbsp; Can anyone help?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="StarfruitBob_0-1670627409269.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48137i30C98876BA408442/image-size/medium?v=v2&amp;amp;px=400" role="button" title="StarfruitBob_0-1670627409269.png" alt="StarfruitBob_0-1670627409269.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;for( i = 1, i &amp;lt;= N Cols( data table( "New" ) ), i++, // col-by-col
		for( j = 1, j &amp;lt;= N rows( data table( "New" ) ), j++, // row-by-row
			if( isempty( column( data table( "New" ), i)[j] ), continue(), // if cell empty, move to next row
				id_val = column( data table( "New" ), i)[j] &amp;amp;
					id_loc = data table( "UID" ) &amp;lt;&amp;lt; Get rows where( :UID == id_val) &amp;amp;
					data table( "New" ):eval( column( data table( "New" ))[j] = data table( "UID" ):UID[ id_loc[1] ]
			);
		);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for your time!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:58:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/579671#M78693</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-06-10T23:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer data between tables</title>
      <link>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/579700#M78695</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/39919"&gt;@StarfruitBob&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;perhaps the following can work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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 );

dtnew = New Table( "new",
	Add Rows( 3 ),
	New Column( "Column 1", Character, "Nominal", Set Values( {"1", "4", ""} ) ),
	New Column( "Column 2", Character, "Nominal", Set Values( {"", "3", ""} ) ),
	New Column( "Column 3", Character, "Nominal", Set Values( {"", "5", "2"} ) )
); 

dtuid = New Table( "uid",
	Add Rows( 5 ),
	New Column( "UID", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 4, 5] ) ),
	New Column( "Val", Character, "Nominal", Set Values( {"apple", "12.3", "987", "abc", "3"} ) )
);

for (i=1, i&amp;lt;=ncols(dtnew), i++,
	for ( ii=1, ii &amp;lt;=nrows (dtnew), ii++,
	if ( Column (dtnew ,i)[ii] == "", continue (), 
	abc= num(  ( (Column (dtnew ,i)[ii])));
	Column (dtnew ,i)[ii] = char (dtuid:val[abc]);
	)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the scripting feels very un natural.&lt;/P&gt;
&lt;P&gt;let us know if it works for your application.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 23:54:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/579700#M78695</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2022-12-09T23:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer data between tables</title>
      <link>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/579701#M78696</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/958"&gt;@ron_horne&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Column (dtnew ,i)[ii] = char (dtuid:val[abc])&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The line above doesn't link the UUID found in the cells of the dt:New to the row of dt:UID that has the corresponding value in :UID and then use that row number to save into the corresponding cell in dt:New.&amp;nbsp; Is there a simple command that can find a row number other than &amp;lt;&amp;lt; Get rows where( :UID == abc&amp;nbsp;)? If so, I think I can build off of what you answered above to complete this script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to make tabulate place in the actual values in the cells directly, regardless of data type &amp;amp; modeling, without statistics?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 00:13:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/579701#M78696</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2022-12-10T00:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Transfer data between tables</title>
      <link>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/580447#M78753</link>
      <description>&lt;P&gt;Solved! Instead of trying to do this with JMP, I just asked someone to modify the SQL query to do this, which is much easier.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 19:39:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Transfer-data-between-tables/m-p/580447#M78753</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2022-12-12T19:39:15Z</dc:date>
    </item>
  </channel>
</rss>

