<?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: Beginner Question about JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442041#M69022</link>
    <description>&lt;P&gt;I think you need to see the program flow, you cannot save the file befor the rows are defined.&lt;/P&gt;&lt;P&gt;May be this small example shows how you can handle, it saves the selected rows from partition platform in a table, when partition is closed. But as Jim mentioned: many ways!&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 );
// opens partition platform on Big Class data table
// when rows are selected, and platform is closed, selected rows are saved in separate data table

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

obj = Partition( Y( :weight ), X( :sex, :height ), Method( "Decision Tree" ), Validation Portion( .2 ) );
obj &amp;lt;&amp;lt; split best();

// When partition window is closed do this:
obj &amp;lt;&amp;lt; on close(
	If( N Items( dt &amp;lt;&amp;lt; get selected rows() ) &amp;gt; 0,
		dtTemp = dt &amp;lt;&amp;lt; subset( invisible, selected rows( 1 ), selected columns( 0 ) );
		filepath = "$TEMP";
		Close( dttemp, save( filepath || "\" || "part1.jmp" ) );
// open file again
		Open( filepath || "\" || "part1.jmp" );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Dec 2021 07:46:05 GMT</pubDate>
    <dc:creator>Georg</dc:creator>
    <dc:date>2021-12-03T07:46:05Z</dc:date>
    <item>
      <title>Beginner Question about JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/441911#M69017</link>
      <description>&lt;P&gt;I want to save the selected rows in a csv or jmp file using JSL. But I am not able to do it Can anyone tell me how to get it done?&lt;/P&gt;&lt;P&gt;I tried by the following code but the way to save it appears to be wrong:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {a},
theRows = Current Data Table() &amp;lt;&amp;lt; get selected rows;
Show( theRows );

);

rs = Current Data Table() &amp;lt;&amp;lt; make row state handler( f );
filepath = "C:\Users\abc\Desktop\trial";
rs &amp;lt;&amp;lt; save( filepath || "\" || "part1.jmp" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:41:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/441911#M69017</guid>
      <dc:creator>shasha_2</dc:creator>
      <dc:date>2023-06-10T23:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Beginner Question about JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/441989#M69018</link>
      <description>&lt;P&gt;There are many ways to handle this.&amp;nbsp; I am assuming you are going to use this JSL with the Partition() platform from your previous discussion, this is the way I would approach the solution&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {a},
	theRows = Current Data Table() &amp;lt;&amp;lt; get selected rows;
	Show( theRows );

);

rs = Current Data Table() &amp;lt;&amp;lt; make row state handler( f );

If( N Rows( theRows ) &amp;gt; 0,
	dt = Current Data Table();
	dtTemp = dt &amp;lt;&amp;lt; subset( invisible, selected rows( 1 ), selected columns( 0 ) );
	filepath = "C:\Users\abc\Desktop\trial";
	Close( dtTemp, save( filepath || "\" || "part1.jmp" ) );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 07:04:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/441989#M69018</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-12-03T07:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Beginner Question about JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442020#M69020</link>
      <description>&lt;P&gt;Yes, It is related with the Partition() platform But when I run the code to save the data, I am not able to save it. I have attached my code because I am not able to understand where the code is failing as in the log it doesn't show any error.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 06:57:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442020#M69020</guid>
      <dc:creator>shasha_2</dc:creator>
      <dc:date>2021-12-03T06:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Beginner Question about JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442041#M69022</link>
      <description>&lt;P&gt;I think you need to see the program flow, you cannot save the file befor the rows are defined.&lt;/P&gt;&lt;P&gt;May be this small example shows how you can handle, it saves the selected rows from partition platform in a table, when partition is closed. But as Jim mentioned: many ways!&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 );
// opens partition platform on Big Class data table
// when rows are selected, and platform is closed, selected rows are saved in separate data table

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

obj = Partition( Y( :weight ), X( :sex, :height ), Method( "Decision Tree" ), Validation Portion( .2 ) );
obj &amp;lt;&amp;lt; split best();

// When partition window is closed do this:
obj &amp;lt;&amp;lt; on close(
	If( N Items( dt &amp;lt;&amp;lt; get selected rows() ) &amp;gt; 0,
		dtTemp = dt &amp;lt;&amp;lt; subset( invisible, selected rows( 1 ), selected columns( 0 ) );
		filepath = "$TEMP";
		Close( dttemp, save( filepath || "\" || "part1.jmp" ) );
// open file again
		Open( filepath || "\" || "part1.jmp" );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Dec 2021 07:46:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442041#M69022</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-12-03T07:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Beginner Question about JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442042#M69023</link>
      <description>&lt;P&gt;I made a mistake in the JSL I provided in my last response.&amp;nbsp; I have since then corrected my response.&lt;/P&gt;
&lt;P&gt;In this response, I have expanded on your provided JSL, and provided a complete example that will save the subsetted table every time a new Select Rows is specified.&lt;/P&gt;
&lt;P&gt;The row state handler is also eliminated when the Partition() window is closed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

tableCount = 0;
theRows = [];

f = Function( {a},
	// Set dupRows to the previously selected rows
	dupRows = theRows;
	// Get the current selected rows
	theRows = Current Data Table() &amp;lt;&amp;lt; get selected rows;
	If( N Rows( theRows ) &amp;gt; 0,
		// check to see if there are the same number of rows and if yes
		// then validate the rows are different rows before saving
		If( N Rows( theRows ) == N Rows( dupRows ),
			If( Sum( dupRows == theRows ) != N Rows( theRows ),
				tableCount++;
				dtTemp = dt &amp;lt;&amp;lt; subset( invisible, selected rows( 1 ), selected columns( 0 ) );
				filepath = "$TEMP";
				Close(
					dtTemp,
					save( filepath || "\" || "part" || Char( tableCount ) || ".jmp" )
				);
				Current Data Table( dt );
			);
		,
			// If not the same number of selected rows, save the subset
			tableCount++;
			Show( tableCount );
			dtTemp = dt &amp;lt;&amp;lt; subset( invisible, selected rows( 1 ), selected columns( 0 ) );
			filepath = "$TEMP";
			Close( dtTemp, save( filepath || "\" || "part" || Char( tableCount ) || ".jmp" ) );
			Current Data Table( dt );
		)
	);
);

rs = Current Data Table() &amp;lt;&amp;lt; make row state handler( f );

obj = Partition(
	Y( :NPN1 ),
	X( :PNP1, :PNP2, :PNP3, :PNP4, :NPN2, :NPN3, :NPN4 ),
	Method( "Decision Tree" ),
	Validation Portion( .2 )
);
obj &amp;lt;&amp;lt; ShowGraph( 0 );
obj &amp;lt;&amp;lt; SplitBest( 4 );
obj &amp;lt;&amp;lt; Show Split Count( 1 );
obj &amp;lt;&amp;lt; Show Split Prob( 1 );
Wait( .5 );

//obj &amp;lt;&amp;lt; Save Predicteds;

obj &amp;lt;&amp;lt; on close( Clear Symbols( rs ) );

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Dec 2021 07:52:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Beginner-Question-about-JSL/m-p/442042#M69023</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-12-03T07:52:06Z</dc:date>
    </item>
  </channel>
</rss>

