<?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 update table after sorting? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265623#M51724</link>
    <description>&lt;P&gt;Hello, thank you for suggestions!&lt;/P&gt;&lt;P&gt;I created one GUI and sorting needs to be done after I select one item from the List Box. After that certain pictures needs to be displayed in this GUI in the order based on the sorted values. Actually, JMP is not providing any useful log information indicating source of problem. Is there any way to hide or make invisible the new (and undesired) datatable that is created after sorting? That would be some workaround.&lt;/P&gt;</description>
    <pubDate>Sun, 10 May 2020 19:39:53 GMT</pubDate>
    <dc:creator>lukasz</dc:creator>
    <dc:date>2020-05-10T19:39:53Z</dc:date>
    <item>
      <title>How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265166#M51665</link>
      <description>&lt;P&gt;Hello Everybody,&lt;/P&gt;&lt;P&gt;I have an issue regarding sorting of a table. I wanted to sort table by Date (located in Date1 column) and I am doing that after certain condition is met. However, it does not sort and replace the table &lt;STRONG&gt;&lt;EM&gt;EL_summary &lt;/EM&gt;&lt;/STRONG&gt;after sorting. Is there any refreshing necessary? I put also some delay, I thought one need to wait some time. When I am not using &lt;STRONG&gt;&lt;EM&gt;replace table(1), &lt;/EM&gt;&lt;/STRONG&gt;the new Table under different name is created and opened (what I don't want) and again data in this table is not sorted. After that, however, data in &lt;STRONG&gt;&lt;EM&gt;EL_summary&lt;/EM&gt;&lt;/STRONG&gt; seems to be updated and sorted. I would appreciate for pointing what I am missing. Best regards&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Current Data Table( EL_summary );&lt;/P&gt;&lt;P&gt;if( N rows(EL_summary) &amp;gt; 0, EL_summary &amp;lt;&amp;lt; sort(by(:name("Date1")), Order( Ascending ), replace table(1)));&lt;BR /&gt;wait(1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 11:43:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265166#M51665</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2020-05-08T11:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265198#M51666</link>
      <description>is your data table inked to a previous table, so it can not be changed?</description>
      <pubDate>Fri, 08 May 2020 12:58:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265198#M51666</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-08T12:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265398#M51697</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;This code performed as expected when there are no graphs open:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp; Untitled = data table("Untitled.jmp");
&amp;nbsp; if( N rows(Untitled) &amp;gt; 0, Untitled &amp;lt;&amp;lt; sort(by(:name("Column 1")), Order( Ascending ), replace table(1)));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the sort fails to work if you have any graphs open,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt; Untitled &amp;lt;&amp;lt;Distribution( Continuous Distribution(Column( :Column 1 )));
&amp;nbsp;&amp;nbsp; if( N rows(Untitled) &amp;gt; 0, Untitled &amp;lt;&amp;lt; sort(by(:name("Column 1")), Order( Descending ), replace table(1)));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Look at the log file and we see:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;JMP cannot replace the existing table because there are report windows that depend on the previous ordering.
&lt;/PRE&gt;
&lt;P&gt;But if we remove replace table, it will execute without error but it will launch a new datatable with the sorted rows which is not desired.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp; Untitled &amp;lt;&amp;lt;Distribution( Continuous Distribution(Column( :Column 1 )));
&amp;nbsp;&amp;nbsp; if( N rows(Untitled) &amp;gt; 0, Untitled &amp;lt;&amp;lt; sort(by(:name("Column 1")), Order( Descending )));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you can check the log file to see if it is informative. If you have any dependent graphs or tables open, maybe you need to rethink the logic of the script. Is it possible to re-sort before making dependent tables and graphs, for example.&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;</description>
      <pubDate>Sat, 09 May 2020 15:07:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265398#M51697</guid>
      <dc:creator>karenb</dc:creator>
      <dc:date>2020-05-09T15:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265623#M51724</link>
      <description>&lt;P&gt;Hello, thank you for suggestions!&lt;/P&gt;&lt;P&gt;I created one GUI and sorting needs to be done after I select one item from the List Box. After that certain pictures needs to be displayed in this GUI in the order based on the sorted values. Actually, JMP is not providing any useful log information indicating source of problem. Is there any way to hide or make invisible the new (and undesired) datatable that is created after sorting? That would be some workaround.&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 19:39:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265623#M51724</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2020-05-10T19:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265624#M51725</link>
      <description>&lt;P&gt;You can handle this in a couple of different ways.&lt;/P&gt;
&lt;P&gt;The output that is keeping the data table from sorting, can be moved to a Journal for display, and the original display can be then deleted, which will allow the sorting to then take place.&lt;/P&gt;
&lt;P&gt;Yo can also create a new data table that is either invisible, or private, which will keep the new data table from being displayed.&amp;nbsp; Look for the Invisible, or Private options in subsetting the data table in the Scripting Index.&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 19:58:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265624#M51725</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-10T19:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265625#M51726</link>
      <description>&lt;P&gt;Ok, I manage to hide the new data table. That data table was the current data table so I disabled its visibility by using&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Data Table() &amp;lt;&amp;lt; ShowWindow( 0 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you all for support. Best regards.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 10:30:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/265625#M51726</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2020-05-11T10:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/659014#M84836</link>
      <description>&lt;P&gt;Hi, what is the official way to sort a data table via JSL with the option &lt;FONT face="courier new,courier"&gt;ReplaceTable()?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As discussed before, If there are open Reports, the script crashes with the error message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1689588481706.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/54800i6C8B536119B5508F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1689588481706.png" alt="hogi_0-1689588481706.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;... even if the graph doesn't depend of the ordering in the data table:&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" );
gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 437, 413 ),
	Graph Spacing( 4 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

dt&amp;lt;&amp;lt; Sort(	By( :height ),	Replace Table,	Order( Ascending ));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about replacing the text with something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Unfortunately, in the current version of Jmp, there is no chance to sort a table with open reports.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Jmp cannot replace the existing table because there is some chance ... hm, you know, report windows might depend on the previous ordering. Unfortunately, there is no option to check that - and there is no option to ignore it. So the Script will stop here.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;:)&lt;/img&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 10:16:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/659014#M84836</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-17T10:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/659031#M84837</link>
      <description>&lt;P&gt;Use Try to catch the error and then handle the error accordingly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(437, 413),
	Graph Spacing(4),
	Variables(X(:height), Y(:weight), Overlay(:sex)),
	Elements(Points(X, Y, Legend(1)), Smoother(X, Y, Legend(2)))
);

Try(
	dt &amp;lt;&amp;lt; Sort(By(:height), Replace Table, Order(Ascending));
,
	If(Starts With(exception_msg[1], "JMP cannot replace the existing table because there are report windows"),
		dt1 = dt &amp;lt;&amp;lt; Sort(By(:age), Order(Ascending)); // will create new table
		/*
		// if you wish to just keep one, order to create new, close old and rename new
		old_name = dt &amp;lt;&amp;lt; get name;
		Close(dt, no save)
		dt1 &amp;lt;&amp;lt; set name(old_name);
		dt = dt1;
		*/
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/sort-data-tables.shtml?os=win&amp;amp;source=application#ww269969" target="_blank" rel="noopener"&gt;Using JMP &amp;gt; Reshape Your Data &amp;gt; Sort Data Tables&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="defTerm"&gt;Replace Table&lt;/P&gt;
&lt;P class="defText"&gt;Replaces the original data table with the sorted table instead of creating a new table with the sorted values. This option is not available if there are any open report windows generated from the original table.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 10:53:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/659031#M84837</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-17T10:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/659107#M84840</link>
      <description>&lt;P&gt;Hm, with this workaround the script won't crash ...&lt;/P&gt;&lt;P&gt;on the other hand: the data won't be sorted but a new table will be generated :(&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the moment, I will prefer something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Try (sort,
Caption("Sorry, not possible to sorting the table, please close all reports and sort manually");stop());&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the future, I hope there will be something like&lt;BR /&gt;&lt;LI-MESSAGE title="Data Table : get reports (and other options)" uid="659112" url="https://community.jmp.com/t5/JMP-Wish-List/Data-Table-get-reports-and-other-options/m-p/659112#U659112" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Try(
	sort, 
	If( New Window( "ask User", ... ), 
		myAffectedReports = dt &amp;lt;&amp;lt; get reports with ordering issues();
		myAffectedReports &amp;lt;&amp;lt; close window;
		sort;
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;sort(..., ignoreEffectOnReports())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;sort(..., closeReportsWithOrderingIssue());&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 08:54:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/659107#M84840</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-21T08:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/660841#M84973</link>
      <description>&lt;P&gt;I want to write an Addin which sorts the data table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of Try(sort, error message) somewhere within the execution of the AddIn, I want to inform the user in the beginning that he has to close all reports before starting the Addin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this with Jmp17?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 08:57:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/660841#M84973</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-21T08:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/660842#M84974</link>
      <description>&lt;P&gt;One option:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use &amp;lt;&amp;lt; Get Window List to get references to all open windows (you can limit this to Type("Reports") if you want to)&lt;/LI&gt;
&lt;LI&gt;Loop over that list and check if there are any which are dependent on the data table being sorted (you should be able to use either the name of the report window OR &amp;lt;&amp;lt; Get Data table. If the report belongs to the data table, add it to list&lt;/LI&gt;
&lt;LI&gt;If there are any items in the list, show the message to user&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 21 Jul 2023 09:32:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/660842#M84974</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-21T09:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/660847#M84975</link>
      <description>&lt;P&gt;Works great thanks :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;closeMyReports = Function( {dt},
	{default local},
	AllmyReports = {};
	myReports = Get Window List( Type( "Reports" ) );
	For Each( {rep}, myReports,
		Try(
			myList = (rep &amp;lt;&amp;lt; Xpath( "//OutlineBox" )) &amp;lt;&amp;lt; get scriptable Object();
			myDTs = Transform Each( {scriptableObject}, myList, If( Is Empty( scriptableObject ), ., scriptableObject &amp;lt;&amp;lt; Get Data Table() ) );
			If( Contains( myDTs, dt ),
				Insert Into( AllmyReports, rep )
			);
		)
	);
	If( N Items( AllmyReports ) &amp;gt; 0,
		If(
			ex = New Window( "",
				&amp;lt;&amp;lt;Type( "Modal Dialog" ),
				&amp;lt;&amp;lt;Return Result,
				V List Box( Text Box( "open reports detected.\!nOK to close them?" ), H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) )
			);
			ex["button"] == 1;
		,
			AllmyReports &amp;lt;&amp;lt; close window(),
			Stop()
		)
	);
);
dt = current data table();
closeMyReports(dt)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;edit:&lt;/STRONG&gt; now the script also checks for more complicated reports with many data tables.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 11:09:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/660847#M84975</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-21T11:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to update table after sorting?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/661607#M85035</link>
      <description>&lt;P&gt;Next step: is there a command:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; get linked subsets()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1690185112674.png" style="width: 758px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/55203iFB4CFA0D65B2D041/image-dimensions/758x36?v=v2" width="758" height="36" role="button" title="hogi_1-1690185112674.png" alt="hogi_1-1690185112674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2023 07:53:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-update-table-after-sorting/m-p/661607#M85035</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-24T07:53:11Z</dc:date>
    </item>
  </channel>
</rss>

