Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
lukasz
Level III

How to update table after sorting?

Hello Everybody,

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 EL_summary 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 replace table(1), 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 EL_summary seems to be updated and sorted. I would appreciate for pointing what I am missing. Best regards


Current Data Table( EL_summary );

if( N rows(EL_summary) > 0, EL_summary << sort(by(:name("Date1")), Order( Ascending ), replace table(1)));
wait(1);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
lukasz
Level III

Re: How to update table after sorting?

Ok, I manage to hide the new data table. That data table was the current data table so I disabled its visibility by using

Current Data Table() << ShowWindow( 0 );

Thank you all for support. Best regards.

View solution in original post

5 REPLIES 5
Highlighted
txnelson
Super User

Re: How to update table after sorting?

is your data table inked to a previous table, so it can not be changed?
Jim
Highlighted
karenb
Level II

Re: How to update table after sorting?

Hi,

This code performed as expected when there are no graphs open:

  Untitled = data table("Untitled.jmp");
  if( N rows(Untitled) > 0, Untitled << sort(by(:name("Column 1")), Order( Ascending ), replace table(1)));

But the sort fails to work if you have any graphs open,
  

 Untitled <<Distribution( Continuous Distribution(Column( :Column 1 )));
   if( N rows(Untitled) > 0, Untitled << sort(by(:name("Column 1")), Order( Descending ), replace table(1)));

Look at the log file and we see:
  

JMP cannot replace the existing table because there are report windows that depend on the previous ordering.

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.
 

  Untitled <<Distribution( Continuous Distribution(Column( :Column 1 )));
   if( N rows(Untitled) > 0, Untitled << sort(by(:name("Column 1")), Order( Descending )));

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.

 

 

 

 

Highlighted
lukasz
Level III

Re: How to update table after sorting?

Hello, thank you for suggestions!

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.

Highlighted
txnelson
Super User

Re: How to update table after sorting?

You can handle this in a couple of different ways.

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.

Yo can also create a new data table that is either invisible, or private, which will keep the new data table from being displayed.  Look for the Invisible, or Private options in subsetting the data table in the Scripting Index.

Jim
Highlighted
lukasz
Level III

Re: How to update table after sorting?

Ok, I manage to hide the new data table. That data table was the current data table so I disabled its visibility by using

Current Data Table() << ShowWindow( 0 );

Thank you all for support. Best regards.

View solution in original post

Article Labels

    There are no labels assigned to this post.