<?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 to correctly clear a Row State Handler in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17420#M15877</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Mar 2016 14:01:29 GMT</pubDate>
    <dc:creator>cis_pete</dc:creator>
    <dc:date>2016-03-16T14:01:29Z</dc:date>
    <item>
      <title>How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17417#M15874</link>
      <description>&lt;P&gt;I have a very simple Row State Handler that makes sure that a given selected row can never be unselected.&amp;nbsp; The issue is, that I want to turn off that functionality and continue with normal operations.&lt;/P&gt;
&lt;P&gt;Here is the simple script that locks down row 15 to always be selected.&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=open("$SAMPLE_DATA\big class.jmp");

x=15;

dt &amp;lt;&amp;lt; select rows(x);

setrow = function({x},dt&amp;lt;&amp;lt;clear
select();dt&amp;lt;&amp;lt; select rows(x));

rs = dt &amp;lt;&amp;lt; Make Row State Handler(setrow(x));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;So now the question is, how do I remove the Row State Handler, short of closing and reopening the data table?&amp;nbsp; I can change the rowstate handler to a different function, but I would prefer to just remove the Row State Handler.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;Does anyone have an answer?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:13:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17417#M15874</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-06-10T23:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17418#M15875</link>
      <description>&lt;P&gt;Probably not the correct solution but I assign an empty function to the row state handler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;empty_function = function({x},{z},
&amp;nbsp;&amp;nbsp;&amp;nbsp; z = 1;
);

rs = dt &amp;lt;&amp;lt; Make Row State Handler(empty_function);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Somehow it does not work if the function is completely empty, so I added z=1 as 'dummy code'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Peter&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: How can you format sample code as 'code' (like you did)? Seems like I am too dumb to understand the forum software.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 13:22:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17418#M15875</guid>
      <dc:creator>cis_pete</dc:creator>
      <dc:date>2021-04-23T13:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17419#M15876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I copy/paste JSL code to MS-Word, then copy/paste it from Word to here.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;empty_function &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000dd;"&gt;function&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10.0pt; font-family: 'Courier New';"&gt;({&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;x&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10.0pt; font-family: 'Courier New';"&gt;{&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;z&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10.0pt; font-family: 'Courier New';"&gt;)&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;rs &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt; dt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;Make Row State Handler&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;empty_function&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 13:27:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17419#M15876</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2016-03-16T13:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17420#M15877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 14:01:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17420#M15877</guid>
      <dc:creator>cis_pete</dc:creator>
      <dc:date>2016-03-16T14:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17421#M15878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The below seems to clear the row state handler (but not the current row states):&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #032ce4;"&gt;Clear Globals&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;rs&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2016 23:51:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/17421#M15878</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2016-03-16T23:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/52714#M29846</link>
      <description>&lt;P&gt;An old question, but why not just setting rs=0 ?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 11:35:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/52714#M29846</guid>
      <dc:creator>thomasz</dc:creator>
      <dc:date>2018-03-07T11:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly clear a Row State Handler</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/379298#M62933</link>
      <description>&lt;P&gt;I think that you only need to assign empty to the variable that previously stored the reference to the handler. You need to use a Wait( 0 ) function call before de-assigning the handler to make sure that all updates are caught up and the script is in sync. (Thanks to Dan Schikore for the tip about Wait.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See this example and examine the Log after it runs. Only the first two row state changes cause output to the Log.&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 );

// example data set
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// example handler
f = Function( {a}, Show( a ) );

// assign handler
rs = dt &amp;lt;&amp;lt; make row state handler( f );

// test handler
dt &amp;lt;&amp;lt; Select Rows( 1 );
dt &amp;lt;&amp;lt; Select Rows( 5 );

Wait( 0 );

// de-assign handler
rs = Empty();

// test absence of handler
dt &amp;lt;&amp;lt; Select Rows( 3 );
dt &amp;lt;&amp;lt; Select Rows( 9 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Apr 2021 17:15:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-correctly-clear-a-Row-State-Handler/m-p/379298#M62933</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-04-23T17:15:04Z</dc:date>
    </item>
  </channel>
</rss>

