<?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: How to reorder columns in one table based on row entries in another table? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631489#M82978</link>
    <description>&lt;P&gt;Here is an example of one&amp;nbsp; way to handle the question&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
table1 = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

table2 = New Table("Table 2", 
	New Column("Sort Order", character,
		Values({"height","weight","sex"})
	)
);

For( i = N Rows( table2 ), i &amp;gt;= 1, i--,
	Try(
		table1 &amp;lt;&amp;lt; go to( Column( table2, 1 )[i] );
		table1 &amp;lt;&amp;lt; Move Selected Columns( To first );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 May 2023 12:26:58 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-05-12T12:26:58Z</dc:date>
    <item>
      <title>How to reorder columns in one table based on row entries in another table?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631463#M82972</link>
      <description>&lt;P&gt;I have two tables - a subset of columns in table 1 have names which are also rows entries (in a column, say column 7) in table 2.&lt;/P&gt;&lt;P&gt;table 2 rows are sorted in a desired (ascending) order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to reorder only those columns in table 1 which have column names occurring in table 2 in the order they are sorted (in column 7) in table 2.&lt;/P&gt;&lt;P&gt;How to achieve this via JSL?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:09:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631463#M82972</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-09T16:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to reorder columns in one table based on row entries in another table?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631483#M82975</link>
      <description>&lt;P&gt;Few questions:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Where should the columns be sorted?
&lt;OL&gt;
&lt;LI&gt;Should they be sorted in place?&lt;/LI&gt;
&lt;LI&gt;Should they be first columns in the table?&lt;/LI&gt;
&lt;LI&gt;Should they be last columns in the table?&lt;/LI&gt;
&lt;LI&gt;Should they start from the first column to be sorted in the table?&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;Is the order in table 2 based on column 7 or some other columns?&lt;/LI&gt;
&lt;LI&gt;Are there example data tables (table1 and table 2) and then table 1 with desired results?&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 12 May 2023 12:17:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631483#M82975</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-12T12:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to reorder columns in one table based on row entries in another table?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631489#M82978</link>
      <description>&lt;P&gt;Here is an example of one&amp;nbsp; way to handle the question&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
table1 = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

table2 = New Table("Table 2", 
	New Column("Sort Order", character,
		Values({"height","weight","sex"})
	)
);

For( i = N Rows( table2 ), i &amp;gt;= 1, i--,
	Try(
		table1 &amp;lt;&amp;lt; go to( Column( table2, 1 )[i] );
		table1 &amp;lt;&amp;lt; Move Selected Columns( To first );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2023 12:26:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631489#M82978</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-05-12T12:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to reorder columns in one table based on row entries in another table?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631493#M82980</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;All valid questions. I will try to &lt;FONT color="#0000FF"&gt;answer&lt;/FONT&gt; them below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Where should the columns be sorted?&amp;nbsp; &lt;FONT color="#0000FF"&gt;Do you mean re-order? Re-ordered&amp;nbsp;columns&amp;nbsp;should be in table 1 (not new table)?&lt;/FONT&gt;&lt;OL&gt;&lt;LI&gt;Should they be sorted in place? &lt;FONT color="#0000FF"&gt;Table 1 has more columns than those which need reordering. See next.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Should they be first columns in the table? &lt;FONT color="#0000FF"&gt;Can do.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Should they be last columns in the table? &lt;FONT color="#0000FF"&gt;Can do. I can handle both option 2 and 3.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Should they start from the first column to be sorted in the table? &lt;FONT color="#0000FF"&gt;The order of (re-ordered) columns in table 1 should be in the order they appear as row entries in (col 7 of) table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Is the order in table 2 based on column 7 or some other columns? &lt;FONT color="#0000FF"&gt;I smell confusion here. I will try again. Row entries in column 7 of table 2 is ordered in a desired order. Row entries in column 7 of table 2&amp;nbsp; are also column names in table 1. I want to re-order the these "common" columns in table 1 in the sequence they appear in table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Are there example data tables (table1 and table 2) and then table 1 with desired results? &lt;FONT color="#0000FF"&gt;I cannot share actual data, but I will try to cook something up and share.&amp;nbsp;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 12 May 2023 12:34:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631493#M82980</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-05-12T12:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to reorder columns in one table based on row entries in another table?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631501#M82982</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 21:47:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reorder-columns-in-one-table-based-on-row-entries-in/m-p/631501#M82982</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-05-12T21:47:19Z</dc:date>
    </item>
  </channel>
</rss>

