<?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: Expand row selection in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872498#M103660</link>
    <description>&lt;P&gt;Don't use Select Where, use Get Rows Where&lt;/P&gt;
&lt;P&gt;It will return the row number for the row that has your 1st Thickness value,&lt;/P&gt;
&lt;P&gt;then use Select Rows() to select the&amp;nbsp;&lt;SPAN&gt;11 rows above and 15 rows below&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 08 May 2025 15:51:31 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2025-05-08T15:51:31Z</dc:date>
    <item>
      <title>Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872486#M103657</link>
      <description>&lt;P&gt;I want to select a specific group of rows surrounding a row I can easily identify.&amp;nbsp; In the instance below, I'm able to capture the row of interest, I now need to expand that by 11 rows above and 15 rows below to have the data block of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Data Table() &amp;lt;&amp;lt; Select where( Contains( As Column(2), "1st Thickness" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 May 2025 15:29:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872486#M103657</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-05-08T15:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872497#M103659</link>
      <description>&lt;P&gt;hi, you can use&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
block of interest = (dt &amp;lt;&amp;lt; get selected rows()) + -11::15;
dt  &amp;lt;&amp;lt; Select Rows( block of interest )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 15:50:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872497#M103659</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-05-08T15:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872498#M103660</link>
      <description>&lt;P&gt;Don't use Select Where, use Get Rows Where&lt;/P&gt;
&lt;P&gt;It will return the row number for the row that has your 1st Thickness value,&lt;/P&gt;
&lt;P&gt;then use Select Rows() to select the&amp;nbsp;&lt;SPAN&gt;11 rows above and 15 rows below&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 15:51:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872498#M103660</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-05-08T15:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872499#M103661</link>
      <description>&lt;P&gt;Hogi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks interesting but gives me an error "Index argument in access or evaluation of 'Index' ,.................................."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 16:02:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872499#M103661</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-05-08T16:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872509#M103662</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;approach is correct.&amp;nbsp; The syntax isn't.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my approach&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
block of interest = (dt &amp;lt;&amp;lt; get selected rows())[1];
block of interest = index(block of interest-11,block of interest+15);
dt  &amp;lt;&amp;lt; Select Rows( block of interest );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suggest you change your paradigm a bit to not count on getting code that you just cut and paste into your script but rather, study the code provided and then mold it into your code, given the new insights it provides.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 16:09:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872509#M103662</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-05-08T16:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872511#M103663</link>
      <description>&lt;P&gt;Few more suggestions&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();
Try(
	r = (dt &amp;lt;&amp;lt; get selected rows())[1];
	dt &amp;lt;&amp;lt; Select Where(r - 11 &amp;lt;= Row() &amp;lt;= r + 15);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

below = 11;
above = 15;

dt = Current Data Table();
r = dt &amp;lt;&amp;lt; Get Selected Rows();
If(N Items(r) != 1,
	Throw("Incorrect amount of rows selected");
);
rows_of_interest = Max(1, r - below)::Min(N Rows(dt), r + above);
dt &amp;lt;&amp;lt; Select Rows(rows_of_interest);

Write();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 May 2025 18:30:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872511#M103663</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-05-08T18:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872512#M103664</link>
      <description>&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works but it only selects the additional rows for the first selected row in the matrix.&amp;nbsp; I guess I should set up an iteration for each initially selected row number to capture them all?&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 18:43:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872512#M103664</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-05-08T18:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872522#M103666</link>
      <description>&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I added iteration and I seem to be getting what I'm after.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

Current Data Table() &amp;lt;&amp;lt; Select where( Contains( As Column(2), "1st Thickness" ));
sel_rows = Current Data Table() &amp;lt;&amp;lt; Get Rows where( Contains( As Column(2), "1st Thickness" ));

j=1;

For( i = 1, i &amp;lt;= N Items( sel_rows ), i++,
block_of_interest = (dt &amp;lt;&amp;lt; get selected rows())[j];
block_of_interest = index(block_of_interest-11,block_of_interest+15);
dt  &amp;lt;&amp;lt; Select Rows( block_of_interest );
	j=j+27;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 May 2025 19:22:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872522#M103666</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-05-08T19:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Expand row selection</title>
      <link>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872523#M103667</link>
      <description>&lt;P&gt;Based on your initial message it seemed like you only wanted to select based on single row. Looping is definitely the easiest option you have and depending on your data it might be fast enough without any optimizations.&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);

dt = Current Data Table();
selrows = dt &amp;lt;&amp;lt; get selected rows();

For Each({r}, selrows,
	dt &amp;lt;&amp;lt; Select Where(r - 11 &amp;lt;= Row() &amp;lt;= r + 15, current selection("extend"));
);
wait(0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And a bit more complicated option&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();
selrows = dt &amp;lt;&amp;lt; get selected rows();
rows_of_interest = {[]};

For Each({r}, selrows,
	rs = Max(1, r - 11)::Min(N Rows(dt), r + 15);
	Insert Into(rows_of_interest, rs`);
);

Substitute Into(rows_of_interest, Expr(List), Expr(V Concat));
dt &amp;lt;&amp;lt; select rows(rows_of_interest);

wait(0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 19:28:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Expand-row-selection/m-p/872523#M103667</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-05-08T19:28:12Z</dc:date>
    </item>
  </channel>
</rss>

