<?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 close existing table data filter at beginning of new script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228295#M45292</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/681"&gt;@john_madden&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you only want the reset selection button pressed at some point here is script.&lt;/P&gt;
&lt;P&gt;This script&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;looks for a table data filter.&lt;/LI&gt;
&lt;LI&gt;If found, it looks for a visible button with the title "Reset selection".&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;If the button is found, click it.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt  = current data table();
dtname = dt &amp;lt;&amp;lt; get name;
winList = get window List();

found = 0; _xzz=empty();
For(i=nitems(winList), i&amp;gt;=1 &amp;amp; !found, i--,
  nme = winList[i] &amp;lt;&amp;lt; Get Window Title; 
  If(Starts With(nme,"Data Filter") &amp;amp; Contains(nme,dtname), 
    found =1;
    _xzz = winList[i] &amp;lt;&amp;lt;xpath("//IfBox[@isTrue='true']//ButtonBox[@title='Reset selection']")
    if(nitems(_xzz) &amp;gt; 0, _xzz[1] &amp;lt;&amp;lt; Click);
    );    	
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want this action to be taken more than at the start of your script, you will need a handler or subscription to define when it needs to be run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;XPath syntax can look a bit strange, but it is very powerful since the JMP report tree structure has an associated XML description.&amp;nbsp; I've attached a script written for chapter 6, section "Scriptable Object and XPath" of&amp;nbsp; &lt;U&gt;&lt;STRONG&gt;JSL Companion, Applications of the JMP Scripting Language, Second Edition&lt;/STRONG&gt; &lt;/U&gt;. The script provides a limited introduction,&amp;nbsp;a few simple examples, and links to learn more.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Oct 2019 11:20:38 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2019-10-07T11:20:38Z</dc:date>
    <item>
      <title>How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/227735#M45186</link>
      <description>&lt;P&gt;I have a script that adds a filter to a data table that is already open. Sometimes a user already has (manually) opened a data filter on that table before the script is invoked.&lt;/P&gt;&lt;P&gt;Such an existing data filter seems to interfere with my new, scripted filter taking efffect -- even though I do a dt &amp;lt;&amp;lt; Clear Row States at the beginning of my script.&lt;/P&gt;&lt;P&gt;So I'd like to have a statement at the beginning of my script that closes any/all existing table filter(s). But I can't figure out how to reference an arbitrary open data filter that someone else has already created outside my own script. Suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 16:43:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/227735#M45186</guid>
      <dc:creator>john_madden</dc:creator>
      <dc:date>2019-09-30T16:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/227783#M45193</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/681"&gt;@john_madden&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As of JMP 14, the only method I know how to do is via brute force. See below. Note &lt;STRONG&gt;Start Over&amp;nbsp;&lt;/STRONG&gt;clears the table selection state&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt  = current data table();
dtname = dt &amp;lt;&amp;lt; get name;
winList = get window List();

found = 0;
For(i=nitems(winList), i&amp;gt;=1 &amp;amp; !found, i--,
  nme = winList[i] &amp;lt;&amp;lt; Get Window Title; 
  If(Starts With(nme,"Data Filter") &amp;amp; Contains(nme,dtname), 
    found =1;
    (winList[i] &amp;lt;&amp;lt; child &amp;lt;&amp;lt; get scriptable object) &amp;lt;&amp;lt; Start Over;
    
    window(nme) &amp;lt;&amp;lt; close window();
    );
    show(i, nme, found);
    	
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are working with an application and the user adds a local data filter and your analyses needs it removed, you can&amp;nbsp; use XPath to find it, get the script, delete the found filter, dow your analysis and restore via the saved script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The attached JSL below shows how to use XPath to get a handle to a data filter on a specific analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 21:38:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/227783#M45193</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-09-30T21:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228251#M45283</link>
      <description>&lt;P&gt;That works, but I think I realized in a little more detail what is happening, which might suggest another solution.&lt;/P&gt;&lt;P&gt;If you create have a table with a filter, and then you change the table row selection elsewhere (this is the case for me), there appears the following in the data filter:&lt;/P&gt;&lt;P&gt;&lt;IMG border="0" /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="screenshot_475.png" style="width: 200px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/19558i16D68316A6BE7C7F/image-size/small?v=v2&amp;amp;px=200" role="button" title="screenshot_475.png" alt="screenshot_475.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think what I need is the script equivalent of pressing the "Reset selection" button.&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Oct 2019 21:48:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228251#M45283</guid>
      <dc:creator>john_madden</dc:creator>
      <dc:date>2019-10-06T21:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228293#M45291</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/681"&gt;@john_madden&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;It is not clear to me what action you want. For example:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ex1: Suppose Big Class was open the associated Data Filter was on column age and 13 and 14 year olds were selected in the filter. Then another application selected female 15 year olds. The Reset button would appear. If clicked, it returns the table selecton defined in the table Data Filter. Is that what you want?&lt;/LI&gt;
&lt;LI&gt;Ex2: same starting scenario as Ex1, but a user deletes a couple rows from the data table. The Reset button does not appear and the previous selections no longer appear in the Data Filter.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;There are methods/functions called "handlers" for a data filter and and a table&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Make Data Filter Handler&lt;/LI&gt;
&lt;LI&gt;Make Row State Handler&lt;/LI&gt;
&lt;LI&gt;Subscribe (for a data table)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Once defined/enabled, action can be taken if row states change, rows are deleted, and more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are just interested in the Reset button, I suspect (haven't tested it yet), the previous script I sent can be modified to find the Data Filter and if the Reset button is not collapsed (is visible) a click can be sent to it. However, before sending a modified script, &lt;EM&gt;&lt;STRONG&gt;a better description of the expected action would be useful.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another consideration, if a user adds a local data filter on a report, the table and if it has a data filter does not reflect user selections from the report's local data filter.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 11:22:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228293#M45291</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-10-07T11:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228295#M45292</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/681"&gt;@john_madden&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you only want the reset selection button pressed at some point here is script.&lt;/P&gt;
&lt;P&gt;This script&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;looks for a table data filter.&lt;/LI&gt;
&lt;LI&gt;If found, it looks for a visible button with the title "Reset selection".&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;If the button is found, click it.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt  = current data table();
dtname = dt &amp;lt;&amp;lt; get name;
winList = get window List();

found = 0; _xzz=empty();
For(i=nitems(winList), i&amp;gt;=1 &amp;amp; !found, i--,
  nme = winList[i] &amp;lt;&amp;lt; Get Window Title; 
  If(Starts With(nme,"Data Filter") &amp;amp; Contains(nme,dtname), 
    found =1;
    _xzz = winList[i] &amp;lt;&amp;lt;xpath("//IfBox[@isTrue='true']//ButtonBox[@title='Reset selection']")
    if(nitems(_xzz) &amp;gt; 0, _xzz[1] &amp;lt;&amp;lt; Click);
    );    	
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want this action to be taken more than at the start of your script, you will need a handler or subscription to define when it needs to be run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;XPath syntax can look a bit strange, but it is very powerful since the JMP report tree structure has an associated XML description.&amp;nbsp; I've attached a script written for chapter 6, section "Scriptable Object and XPath" of&amp;nbsp; &lt;U&gt;&lt;STRONG&gt;JSL Companion, Applications of the JMP Scripting Language, Second Edition&lt;/STRONG&gt; &lt;/U&gt;. The script provides a limited introduction,&amp;nbsp;a few simple examples, and links to learn more.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 11:20:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228295#M45292</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-10-07T11:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228405#M45312</link>
      <description>&lt;P&gt;Thanks so much, gz.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The xpath function is great! As it happens, I come from an XML background and have used xpath in the past. But I was completely unaware you could use it this way in JMP.&amp;nbsp;And I've found it challenging to navigate display trees until now. So this is a real find. Very helpful!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 19:22:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228405#M45312</guid>
      <dc:creator>john_madden</dc:creator>
      <dc:date>2019-10-07T19:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228520#M45334</link>
      <description>&lt;P&gt;Fooling around, I found a simple solution:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = N Items( Get Window List() ), i &amp;gt;= 1, i--,
     Try(
         Data Filter[i] &amp;lt;&amp;lt; Close;&lt;BR /&gt;         Data Table[i] &amp;lt;&amp;lt; Clear Row States  // optional, if you want to&lt;BR /&gt;     )&lt;BR /&gt;);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I had no idea about the Data Filter[i] syntax. Makes it simple.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 19:28:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/228520#M45334</guid>
      <dc:creator>john_madden</dc:creator>
      <dc:date>2019-10-08T19:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/580134#M78730</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Filter[i]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;cool!&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;Where is this documented?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 10:34:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/580134#M78730</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-12-12T10:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to close existing table data filter at beginning of new script</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/582877#M78907</link>
      <description>&lt;P&gt;I found in the Scripting Index that one can reference a data table via&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = data table(i);
dt = data table(name);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and get the name via&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; get name();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there also a function to get "i".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean directly, not via&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Loc(Get Data Table List(),data table(2))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, I just noticed that Data Filters have their own index - independent of the respective Data Tables ...&lt;BR /&gt;So &lt;FONT face="courier new,courier"&gt;Data Fitler[i]&lt;/FONT&gt; cannot be used to access a specific data filter (via data table-&amp;gt; i --&amp;gt; data filter) ?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 09:41:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-close-existing-table-data-filter-at-beginning-of-new/m-p/582877#M78907</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-12-17T09:41:04Z</dc:date>
    </item>
  </channel>
</rss>

