<?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 do I automatically add all columns to the Column Switcher in .jsl in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284175#M54891</link>
    <description>&lt;P&gt;The scripting is very straight forward,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Loop across all data tables
For( i = 1, i &amp;lt;= N Table(), i++, 

	dt = Data Table( i );
	
	// Find all of the column names
	colList = dt &amp;lt;&amp;lt; get column names( string );
	
	// Get the first 3 columns for special processing
	col1 = colList[1];
	col2 = colList[2];
	col3 = colList[3];

	// Remove first 2 from column switcher columns from the overall list
	Remove From( colList, 1, 2 );

	// Run the Graph Builder
	
	dt &amp;lt;&amp;lt; Graph Builder(
		Size( 570, 621 ),
		Variables(
			X( As Column( col2 ) ),
			Y( As Column( col3 ) ),
			Overlay( As Column( col1 ) )
		),
		Elements( Points( X, Y, Legend( 10 ) ), Line( X, Y, Legend( 11 ) ) ),
		Column Switcher( col3, colList )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Aug 2020 00:20:51 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-08-05T00:20:51Z</dc:date>
    <item>
      <title>How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284172#M54890</link>
      <description>&lt;P&gt;I'm very much a beginner with JSL, I'm still learning --&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have many files that I need to review with Graph Builder, and each has a different number of columns. &amp;nbsp;The only constant is that I know I want column 1 as the Overlay, column 2 in the X-axis, column 3 in the Y-axis, and all the rest of the columns in the Column Switcher. &amp;nbsp;I'd love to have a script that would open up all the Graph Builder windows for all the currently-open data tables with these settings, but I don't know how to do that. &amp;nbsp;This is the closest I've gotten:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Size( 1900, 1200 ),
	Variables(
		X( :Column(2) ),
		Y( :Column(3) ),
		Overlay( :Column(1) )
	),
	Elements( Points( X, Y, Legend( 10 ) ), Line( X, Y, Legend( 11 ) ) ),
	Column Switcher( :Column(3) ),
	SendToReport(
		Dispatch(
			{},
			"",
			ScaleBox
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The two things I need help with: &amp;nbsp;(1) figure out how to set the Column Switcher to automatically load up all the columns in the data table without asking me, and (2) wrap this script in a loop that iterates over all the open data tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:04:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284172#M54890</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2023-06-11T11:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284175#M54891</link>
      <description>&lt;P&gt;The scripting is very straight forward,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Loop across all data tables
For( i = 1, i &amp;lt;= N Table(), i++, 

	dt = Data Table( i );
	
	// Find all of the column names
	colList = dt &amp;lt;&amp;lt; get column names( string );
	
	// Get the first 3 columns for special processing
	col1 = colList[1];
	col2 = colList[2];
	col3 = colList[3];

	// Remove first 2 from column switcher columns from the overall list
	Remove From( colList, 1, 2 );

	// Run the Graph Builder
	
	dt &amp;lt;&amp;lt; Graph Builder(
		Size( 570, 621 ),
		Variables(
			X( As Column( col2 ) ),
			Y( As Column( col3 ) ),
			Overlay( As Column( col1 ) )
		),
		Elements( Points( X, Y, Legend( 10 ) ), Line( X, Y, Legend( 11 ) ) ),
		Column Switcher( col3, colList )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 00:20:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284175#M54891</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-08-05T00:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284200#M54894</link>
      <description>Impressive! I kept trying to use "Column Switcher( :Column(3), :Column(all) )" and variations of that&lt;BR /&gt;&lt;BR /&gt;Would any of these improvements to the script be possible? (1) Give it instead a folder full of txt files, and have it open them one at a time in Graph Builder, and when I close Graph Builder, it closes the corresponding Data Table file and opens the next one, (2) automatically move the focus to the column switcher so I can immediately begin arrowing through the variables without needing to click in the column switcher box, (3) full size the Graph Builder window on the screen when it opens.&lt;BR /&gt;&lt;BR /&gt;JMP is quickly becoming my favorite piece of software.</description>
      <pubDate>Wed, 05 Aug 2020 03:31:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284200#M54894</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2020-08-05T03:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284207#M54895</link>
      <description>&lt;P&gt;All of what you suggest is doable in JMP.&lt;/P&gt;
&lt;P&gt;You can use "Files in Directory()"&amp;nbsp; to get the file list, and then loop through them.&lt;/P&gt;
&lt;P&gt;You can attach an "On Close()" function to the Graph Builder object, which will close the current data table, and then go get the next file from your list of files from the "Files in Directory()" list.&lt;/P&gt;
&lt;P&gt;Examples and description are in the Scripting Index&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Help==&amp;gt;Scripting Index&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 03:59:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284207#M54895</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-08-05T03:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284565#M54968</link>
      <description>Thanks!&lt;BR /&gt;How about #2 in my list? (I think I can figure out #3...)</description>
      <pubDate>Thu, 06 Aug 2020 20:01:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284565#M54968</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2020-08-06T20:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284583#M54973</link>
      <description>I do not know of a way to do the second request.</description>
      <pubDate>Thu, 06 Aug 2020 21:15:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284583#M54973</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-08-06T21:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284629#M54978</link>
      <description>&lt;P&gt;I can't find a way either but a few presses of the tab key will shift the focus to the list of columns in the column switcher.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TabToColumnSwitcher.gif" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/26068i073F4A25FF255CEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TabToColumnSwitcher.gif" alt="TabToColumnSwitcher.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 22:10:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/284629#M54978</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2020-08-06T22:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/296383#M55754</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; --&amp;nbsp;I just spent about 3 hours with the Scripting Index and Scripting Guide trying to make this work, but couldn't figure out how to make the "on close()" function open the next file. &amp;nbsp;Here's what I thought *should* work, but doesn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Reminder, the goal is to step through these files one at a time, bringing up a Graph Builder window and letting me evaluate the file, then when I close the Graph Builder window, it should close the data table and open up the next file and plot it.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This script is called "jmp_reg_4.jsl" and is on my Desktop:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 0 );  // &amp;lt;-- trying to use globals so the file list will be maintained between invocations

/*
All of what you suggest is doable in JMP.
You can use "Files in Directory()"  to get the file list, and then loop through them.
You can attach an "On Close()" function to the Graph Builder object, which will close the current data table, and then go get the next file from your list of files from the "Files in Directory()" list.
Examples and description are in the Scripting Index
     Help==&amp;gt;Scripting Index
*/   


If( Not( As Global( "flist" ) ),
	jmpDir = Pick Directory( "Select the jmp directory." );
	flist = Files In Directory( jmpDir );
);

dt = Open( jmpDir || "/" || flist[1] );
Remove( flist, 1 );

colList = dt &amp;lt;&amp;lt; get column names( string );
col1 = colList[1];
col2 = colList[2];
col3 = colList[3];
Remove From( colList, 1, 2 );
gb = dt &amp;lt;&amp;lt; Graph Builder(
	size( 800, 600 ),
	Variables( X( As Column( col2 ) ), Y( As Column( col3 ) ), Overlay( As Column( col1 ) ) ),
	Elements( Points( X, Y, Legend( 10 ) ), Line( X, Y, Legend( 11 ) ) )
);
cs = gb &amp;lt;&amp;lt; Column Switcher( col3, colList );
gb &amp;lt;&amp;lt; on close(
	Close( dt, nosave );
	run script( "/Users/bh/Desktop/jmp_reg_4.jsl" );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I thought I was creating a global list of files to examine, and then at every invocation, if I still have elements in the "flist" (file-list) variable, then we simply grab the next one and load it and plot it. &amp;nbsp;But it's not working as I expect: &amp;nbsp;when I close the graph builder window, it correctly closes the data table, but then does nothing else.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 06:02:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/296383#M55754</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2020-09-01T06:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/296775#M55789</link>
      <description>&lt;P&gt;I figured it out. &amp;nbsp;I really wish JMP had a terminal sometimes...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone else finds themselves here looking for this same solution, please reply and I'll share what I ended up with.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 20:59:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/296775#M55789</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2020-09-01T20:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/297426#M55794</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12313"&gt;@BHarris&lt;/a&gt;&amp;nbsp;It should would be nice if you could add your solution to this discussion, so it can be available to the whole Discussion Community.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 23:02:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/297426#M55794</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-01T23:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automatically add all columns to the Column Switcher in .jsl</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/298122#M55850</link>
      <description>&lt;P&gt;Thanks to those here who helped, I feel like I didn't add much of my own here. &amp;nbsp;This is basically what I ended up with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal was to have a script that would go through a folder full of text files one at a time, load it, and bring up a Graph Builder window with some settings pre-set, then when Graph Builder is closed, it automatically opens the next one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The approach I used was to manage it with global variables: &amp;nbsp;"regFlist" is the list of files left to open, and "stopReg" is a flag that when turned on interrupts the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are two scripts: &amp;nbsp;(1) reg_Next.jsl -- checks regFlist, and if it's empty, it asks for a folder to use; otherwise it loads the next file from the regFlist list (if regStop is not set), (2) reg_Stop.jsl -- simply empties regFlist and sets the regStop variable; used to stop the process early.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a total beginner with .jsl, so I'm very open to any feedback/constructive-criticism.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;reg_Next.jsl&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//!&lt;BR /&gt;&lt;BR /&gt;// use global variables (since hey, what could go wrong? ;) )
Names Default To Here( 0 );

// get path to self
selfPath = get default directory() || "/reg_Next.jsl";

// check to see if user has requested a stop
If( stopReg == 1 ,
	stopReg = 0;
	regFlist = {};
	Stop();
);

// initialize list of files to review if there aren't any in the list
If( Is Empty( regFlist ) | N Items( regFlist ) &amp;lt; 1,
	jmpDir = Pick Directory( "Select the jmp directory." );
	regFlist = Files In Directory( jmpDir );
);

// open data table and remove it from the regFlist
dt = Open( jmpDir || "/" || regFlist[1] );
regFlist = Remove( regFlist, 1 );

// set up for column switcher
colList = dt &amp;lt;&amp;lt; get column names( string );
col1 = colList[1];
col2 = colList[2];
col3 = colList[3];
Remove From( colList, 1, 2 );

// open graph builder
gb = dt &amp;lt;&amp;lt; Graph Builder(
	size( 800, 600 ),
	Variables( X( As Column( col2 ) ), Y( As Column( col3 ) ), Overlay( As Column( col1 ) ) ),
	Elements( Points( X, Y, Legend( 10 ) ), Line( X, Y, Legend( 11 ) ) )
);
cs = gb &amp;lt;&amp;lt; Column Switcher( col3, colList );

// set up mechanism to re-run myself when graph builder is closed
If( N Items( regFlist ) == 0,
	gb &amp;lt;&amp;lt; on close( Close( dt, nosave ) ),
	gb &amp;lt;&amp;lt; on close(
		Close( dt, nosave );
		Open( selfPath, Run JSL( 1 ) );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;reg_Stop.jsl&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//!
Names Default To Here( 0 );
regFlist = {};
stopReg = 1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Sep 2020 22:19:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-automatically-add-all-columns-to-the-Column-Switcher-in/m-p/298122#M55850</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2020-09-02T22:19:16Z</dc:date>
    </item>
  </channel>
</rss>

