<?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 select rows with certain string and make subset in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398299#M64923</link>
    <description>&lt;P&gt;Here is a working example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
// Create the concat data table
concat_dt = New Table( "concat data table",
	Add Rows( 4 ),
	New Column( "Source Table",
		Character,
		"Nominal",
		Set Values( {"A", "A", "B", "B"} )
	),
	New Column( "Sample_ID",
		Character,
		"Nominal",
		Set Values(
			{"71MT052800452", "71MT052800193", "71MT052800452", "71MT052800120"}
		),
		Set Display Width( 120 )
	),
	New Column( "X_loc",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [-34005, -32288, -30571, -21986] )
	),
	New Column( "Y_Loc",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [-26500, 26500, -26500, 26500] )
	),
	New Column( "Z_Loc",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [83.2, -20.3, 14.5, -78.3] )
	)
);

// Create the subset data

prep_dt = concat_dt &amp;lt;&amp;lt; Subset(
	Rows( concat_dt &amp;lt;&amp;lt; get rows where( Right( :Sample_ID, 3 ) == "452" ) ),
	selected columns only( 0 ), 
);

Close( concat_dt ); // close concat_dt&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Jul 2021 07:42:55 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-07-05T07:42:55Z</dc:date>
    <item>
      <title>JSL select rows with certain string and make subset</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398236#M64906</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to select certain rows that have string ended with "452" in column "Sample_ID" and make a subset containing these rows. I try to do like below but it didn't work&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 );
Clear Log();
Clear Symbols();
Close All( Data Tables, NoSave );
Close All( Journals, NoSave );

// pick data table 1
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 ); // show dt1_Name string in log
dt1 = Open( dt1_Name ); // reassign dt1 to data table from string dt1_Name
Show( dt1 ); // show data table dt1 in log to check

// pick data table 2
dt2_dir = Pick Directory( "Select directory for data table 2" );
dt2_Name = Pick File( "Select data file 2", dt2_dir, {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, 0 );
Show( dt2_Name );
dt2 = Open( dt2_Name );
Show( dt2 );

//concatenate two tables and concat_dt is the output table
concat_dt = dt1 &amp;lt;&amp;lt; Concatenate( dt2, Output Table( "concat data table" ), Create Source Column );
Show( concat_dt ); //show concat_dt data table in log
Close( dt1, NoSave );
Close( dt2, NoSave ); //close both dt1 and dt2


//select specific sample_ID from concat_dt and make subset out of it
prep_dt = concat_dt &amp;lt;&amp;lt; Subset(
	Row( concat_dt &amp;lt;&amp;lt; get rows where( Regex( :Sample_ID, "71MT052800452" ) == :Sample_ID ) ),
	selected columns only( 0 ),

);

Close( concat_dt ); // close concat_dt
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:51:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398236#M64906</guid>
      <dc:creator>achid03</dc:creator>
      <dc:date>2023-06-09T19:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: JSL select rows with certain string and make subset</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398262#M64910</link>
      <description>&lt;P&gt;Try this for your row selection&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Row( concat_dt &amp;lt;&amp;lt; get rows where( Right( :Sample_ID, 3 ) == "452" ) ),&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Jul 2021 12:50:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398262#M64910</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-04T12:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: JSL select rows with certain string and make subset</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398281#M64915</link>
      <description>&lt;P&gt;I tried it but it didn't work. I got this message in log:&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="achid03_0-1625443750410.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33966i33DEEFED368FAB3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="achid03_0-1625443750410.png" alt="achid03_0-1625443750410.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 00:09:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398281#M64915</guid>
      <dc:creator>achid03</dc:creator>
      <dc:date>2021-07-05T00:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: JSL select rows with certain string and make subset</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398291#M64918</link>
      <description>&lt;P&gt;It appears to not to be able to find the data table called "concat data table".&lt;BR /&gt;Make sure that table has been created before you specify the data table function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would also be useful if you provided examples of your input data tables.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 03:13:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398291#M64918</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-05T03:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: JSL select rows with certain string and make subset</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398298#M64922</link>
      <description>&lt;P&gt;the data table "concat data table" looks like this.&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="achid03_0-1625469894502.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33968iBA67E8076F14EDCE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="achid03_0-1625469894502.png" alt="achid03_0-1625469894502.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the table is already open after concatenating&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 07:25:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398298#M64922</guid>
      <dc:creator>achid03</dc:creator>
      <dc:date>2021-07-05T07:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: JSL select rows with certain string and make subset</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398299#M64923</link>
      <description>&lt;P&gt;Here is a working example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
// Create the concat data table
concat_dt = New Table( "concat data table",
	Add Rows( 4 ),
	New Column( "Source Table",
		Character,
		"Nominal",
		Set Values( {"A", "A", "B", "B"} )
	),
	New Column( "Sample_ID",
		Character,
		"Nominal",
		Set Values(
			{"71MT052800452", "71MT052800193", "71MT052800452", "71MT052800120"}
		),
		Set Display Width( 120 )
	),
	New Column( "X_loc",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [-34005, -32288, -30571, -21986] )
	),
	New Column( "Y_Loc",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [-26500, 26500, -26500, 26500] )
	),
	New Column( "Z_Loc",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [83.2, -20.3, 14.5, -78.3] )
	)
);

// Create the subset data

prep_dt = concat_dt &amp;lt;&amp;lt; Subset(
	Rows( concat_dt &amp;lt;&amp;lt; get rows where( Right( :Sample_ID, 3 ) == "452" ) ),
	selected columns only( 0 ), 
);

Close( concat_dt ); // close concat_dt&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jul 2021 07:42:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-select-rows-with-certain-string-and-make-subset/m-p/398299#M64923</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-05T07:42:55Z</dc:date>
    </item>
  </channel>
</rss>

