<?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 Update Column Name from Configuration File Using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314324#M56634</link>
    <description>&lt;P&gt;Hi JMP users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to update column names from a configuration file using JSL and make plots which will have the updated column names in their titles and axes. I am looking for ideas on how I can do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching my code so far and tables. Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached what I would like the final graph to look like (desired_Bivariate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Simon&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
dt1 &amp;lt;&amp;lt; New Column( "New Column", character, formula( Column_name || "_" || additional_name ) );

graph = dt &amp;lt;&amp;lt; Bivariate( Y( :height ), X( :id ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 23:39:11 GMT</pubDate>
    <dc:creator>simon_2</dc:creator>
    <dc:date>2023-06-09T23:39:11Z</dc:date>
    <item>
      <title>Update Column Name from Configuration File Using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314324#M56634</link>
      <description>&lt;P&gt;Hi JMP users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to update column names from a configuration file using JSL and make plots which will have the updated column names in their titles and axes. I am looking for ideas on how I can do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching my code so far and tables. Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached what I would like the final graph to look like (desired_Bivariate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Simon&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
dt1 &amp;lt;&amp;lt; New Column( "New Column", character, formula( Column_name || "_" || additional_name ) );

graph = dt &amp;lt;&amp;lt; Bivariate( Y( :height ), X( :id ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:39:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314324#M56634</guid>
      <dc:creator>simon_2</dc:creator>
      <dc:date>2023-06-09T23:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Update Column Name from Configuration File Using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314361#M56635</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );

for(i = 1, i &amp;lt;= N Rows(dt1), i++,
	x = Column(dt1, "Column_name")[i];
	y = Column(dt1, "additional_name")[i];
	Column(dt, i) &amp;lt;&amp;lt; Set Name( x || "_" || y);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:04:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314361#M56635</guid>
      <dc:creator>ThuongLe</dc:creator>
      <dc:date>2020-09-29T06:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Update Column Name from Configuration File Using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314456#M56638</link>
      <description>&lt;P&gt;Here are 2 different approaches to the issue that do not change the actual name of the columns, but accomplishes what you are asking for.&amp;nbsp; The first one creates Transform columns that have the new names specified for the run of the bivariate.&amp;nbsp; Those columns only exist for the bivariate execution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="trans1.PNG" style="width: 823px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/27055i8E64BA4C6FD6F55F/image-size/large?v=v2&amp;amp;px=999" role="button" title="trans1.PNG" alt="trans1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The second example uses the Units Column Property for the different columns in the data table.&amp;nbsp; The platforms in JMP honor the Units column property, and display it as an addition to the actual column name by placing the Units value in () following the column name.....(i.e. Height(feet) )&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="trans2.PNG" style="width: 829px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/27056iD94D1A62642A443A/image-size/large?v=v2&amp;amp;px=999" role="button" title="trans2.PNG" alt="trans2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// This version of the script used Transform variables
// to temporarially change the name of the column just
// for the running of the Bivariate

Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );

// Loop across the columns to run the Bivariate
For( i = 2, i &amp;lt;= N Cols( dt ), i++,
	// Check to see if a column name change is specified
	// in the config table
	foundRow = dt1 &amp;lt;&amp;lt; get rows where(
		:Column_name == Column( dt, i ) &amp;lt;&amp;lt; get name &amp;amp; dt1
		:additional_name != ""
	);
	// If a column name change is found make the change
	If( N Rows( foundRow ) &amp;gt; 0,
		Eval(
			Substitute(
					Expr(
						Bivariate(
							Y(
								Transform Column(
									__trans__,
									Formula( __col__ )
								)
							),
							X( :id )
						)
					),
				Expr( __trans__ ),
					dt1:Column_name[foundRow[1]] || "_" || dt1
					:additional_name[foundRow[1]],
				Expr( __col__ ),
					Parse( ":" || dt1:Column_name[foundRow[1]] )
			)
		),
		// otherwise just run the bivariate
		dt &amp;lt;&amp;lt; Bivariate( Y( Column( i ) ), X( :id ) )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// This version of the script takes advantage of the Units
// column property.  It will automatically add (unit value) to
// the display output, without actually changing the columns
// name
Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );

// Add the Units Column Property to the columns in the
// original data table
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	foundRow = dt1 &amp;lt;&amp;lt; get rows where(
		:Column_name == Column( dt, i ) &amp;lt;&amp;lt; get name &amp;amp; dt1
		:additional_name != ""
	);

	If( N Rows( foundRow ) &amp;gt; 0,
		column( dt, i ) &amp;lt;&amp;lt; set property("units", eval(dt1:additional_name[foundRow[1]]));
	);
);

// Now run the normal bivariates
For( i = 2, i &amp;lt;= N Cols( dt ), i++,
	dt &amp;lt;&amp;lt; Bivariate( Y( Column( i ) ), X( :id ) )
);
	
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:22:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314456#M56638</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-29T09:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Update Column Name from Configuration File Using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314581#M56651</link>
      <description>&lt;P&gt;Great. Thanks ThuongLe.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:54:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314581#M56651</guid>
      <dc:creator>simon_2</dc:creator>
      <dc:date>2020-09-29T14:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update Column Name from Configuration File Using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314582#M56652</link>
      <description>&lt;P&gt;Awesome. Thanks Jim.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:55:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Column-Name-from-Configuration-File-Using-JSL/m-p/314582#M56652</guid>
      <dc:creator>simon_2</dc:creator>
      <dc:date>2020-09-29T14:55:05Z</dc:date>
    </item>
  </channel>
</rss>

