<?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: JSL rename columns based on user selection in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457775#M70280</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;box["a"]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;returns a JMP List,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;{:NPN1}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;not a string or an expression.&amp;nbsp; Therefore you need to properly extract the element from the list, and present it back to JSL as a column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;as column((box["a"])[1]) &amp;lt;&amp;lt; Set Name( :build date" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here are the modification you need to make to make the name changes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;as column((box["a"])[1]) &amp;lt;&amp;lt; set name( "build date" );
as column((box["b"])[1]) &amp;lt;&amp;lt; set name( "shipping date" );
as column((box["c"])[1]) &amp;lt;&amp;lt; set name( "buy date" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 Feb 2022 13:57:03 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-02-02T13:57:03Z</dc:date>
    <item>
      <title>JSL rename columns based on user selection</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457725#M70276</link>
      <description>&lt;P&gt;I am trying to rename column names based on user selection of file. But, I am having trouble renaming the columns. I have added my code, the set name doesn't work for renaming. I think I am doing something wrong. Can anyone please let me know about this?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Log();
dt1_dir = Pick Directory( "Select directory for data table 1" );
dt1_Name = Pick File( "Select data file 1", dt1_dir, {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, 0 );
Show( dt1_Name ); 
dt = Open( dt1_Name ); 
Show( dt ); 

dt&amp;lt;&amp;lt; bring window to front;
box = column dialog(
a=collist("BDATE", MAX col(1), min col(1),DataType ("Numeric")),
b=collist("SHIPDATE", MAX col(1), min col(1), DataType ("Numeric")),
c=collist("BUY Date", MAX col(1),min col(1), DataType ("Numeric")), 
);

box["a"] &amp;lt;&amp;lt; set name("build date")
box["b"] &amp;lt;&amp;lt; set name("shipping date")
box["c"] &amp;lt;&amp;lt; set name("buy date")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:43:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457725#M70276</guid>
      <dc:creator>shasha_2</dc:creator>
      <dc:date>2023-06-10T23:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: JSL rename columns based on user selection</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457775#M70280</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;box["a"]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;returns a JMP List,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;{:NPN1}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;not a string or an expression.&amp;nbsp; Therefore you need to properly extract the element from the list, and present it back to JSL as a column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;as column((box["a"])[1]) &amp;lt;&amp;lt; Set Name( :build date" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here are the modification you need to make to make the name changes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;as column((box["a"])[1]) &amp;lt;&amp;lt; set name( "build date" );
as column((box["b"])[1]) &amp;lt;&amp;lt; set name( "shipping date" );
as column((box["c"])[1]) &amp;lt;&amp;lt; set name( "buy date" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Feb 2022 13:57:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457775#M70280</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-02-02T13:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: JSL rename columns based on user selection</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457776#M70281</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/32612"&gt;@shasha_2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I'm not 100% sure of what you want to do and how you intend to use the Column Dialog() command, but the script below will do what you want. It also gives you a lot more flexibility in terms of what options you have in your new window, etc. If you want to make the window modal, just add &amp;lt;&amp;lt;Modal here: New Window("Select Columns", &amp;lt;&amp;lt;Modal,&amp;nbsp; -- and then continue on.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

bwidth = 100;

dt = New Table("test",
	Add Rows(3),
	New Column("Col 1", Continuous),
	New Column("Col 2", Continuous),
	New Column("Col 3", Continuous)
);

dt &amp;lt;&amp;lt; bring window to front;
box_win = New Window( "Select Columns",
	H List Box(
		Panel Box( "Select Columns", ColListData = Col List Box( dt, All, Grouped, width( bwidth ), nLines( 5 ) ) ),
		V List Box(
			Panel Box( "Case Selected Columns Into Roles",
				Lineup Box( N Col( 2 ), Spacing( 3 ),
					Button Box( "BDATE", colLista &amp;lt;&amp;lt; Append( ColListData &amp;lt;&amp;lt; Get Selected ) ),
					ColLista = Col List Box( width( bwidth ), N Lines( 1 ), Max Items( 1 ), Min Items( 1 ), &amp;lt;&amp;lt;Set Data Type( "Numeric" ) ),
					Button Box( "SHIPDATE", colListb &amp;lt;&amp;lt; Append( ColListData &amp;lt;&amp;lt; Get Selected ) ),
					ColListb = Col List Box( width( bwidth ), N Lines( 1 ), Max Items( 1 ), Min Items( 1 ), &amp;lt;&amp;lt;Set Data Type( "Numeric" ) ),
					Button Box( "BUY Date", colListc &amp;lt;&amp;lt; Append( ColListData &amp;lt;&amp;lt; Get Selected ) ),
					ColListc = Col List Box( width( bwidth ), N Lines( 1 ), Max Items( 1 ), Min Items( 1 ), &amp;lt;&amp;lt;Set Data Type( "Numeric" ) ),
					Button Box( "Remove",
						ColLista &amp;lt;&amp;lt; RemoveSelected;
						ColListb &amp;lt;&amp;lt; RemoveSelected;
						ColListc &amp;lt;&amp;lt; RemoveSelected;
					),
					Spacer Box()
				)
			),
			Lineup Box( N Col( 3 ), Spacing( 0, 3 ),
				Spacer Box( &amp;lt;&amp;lt;Set Auto Stretching( 1, 0 ) ),
				Button Box( "OK",
					acol = ColLista &amp;lt;&amp;lt; Get Items;
					As Column( acol ) &amp;lt;&amp;lt; Set Name( "build date" );
					bcol = ColListb &amp;lt;&amp;lt; Get Items;
					As Column( bcol ) &amp;lt;&amp;lt; set name( "shipping date" );
					ccol = ColListc &amp;lt;&amp;lt; Get Items;
					As Column( ccol ) &amp;lt;&amp;lt; set name( "buy date" );
					box_win &amp;lt;&amp;lt; Close Window;
				),
				Button Box( "Cancel", box_win &amp;lt;&amp;lt; Close Window )
			)
		)

	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 14:04:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-rename-columns-based-on-user-selection/m-p/457776#M70281</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2022-02-02T14:04:49Z</dc:date>
    </item>
  </channel>
</rss>

