cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
jthi
Super User

Any idea why Move Selected Columns works with a list was changed in JMP17?

Just noticed that my Analyse Columns doesn't work with JMP17, or even worse it returns incorrect data. Issue is that JMP17 has changed how Move Selected Columns works with a list.

Names Default To Here(1);

dt = Open( "$SAMPLE_DATA/Big Class.jmp");
list = {"sex", "name"};

wait(1);
dt << Move Selected Columns(list, To Last);
show(JMP Version());

With this simple example you can see that JMP17 ignores the order of items in the list (or rather sorts alphabetically?)

 

JMP16:

jthi_1-1674837784475.png

 

JMP17:

jthi_0-1674837768976.png

 

I can figure out many ways to handle this, but I'm not really sure if I should have to

Names Default To Here(1);

dt = Open( "$SAMPLE_DATA/Big Class.jmp");

list = {"sex", "name", "age", "weight", "height"};
If(Num(Word(1, JMP Version(), ".")) < 17,
	dt << Move Selected Columns(list, To Last);
, // else
	first_col = Remove From(list, 1);
	dt << Move Selected Columns(first_col, To First);
	For Each({col}, list,
		Eval(EvalExpr(
			dt << Move Selected Columns({Expr(col)}, To Last);
		));
	);
);
-Jarmo
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

This was done to fix a crash. Unfortunately, it has proved to have unintended consequences.

 

It isn't sorting the columns by name, it's maintaining their original ordering. No matter how you order columns in the list given to Move Selected Columns(), the moved columns will maintain their original ordering relative to each other. So if you have a table with columns a, b, c, and d, in that order, then both Move Selected Columns({:b, :a}, To Last) and Move Selected Columns({:a, :b}, To Last) will result in the columns being ordered c, b, a, b.

 

As you discovered, an admittedly inconvenient workaround is to issue multiple Move Selected Columns commands. So to get the order c, d, b, a you can call Move Selected Columns({:b}, To Last) then Move Selected Columns({:a}, To Last).

 

This will be fixed.

View solution in original post

9 REPLIES 9
FN
FN
Level VI

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

Joining the discussion to know if this is a bug.

 

This will probably break the functionality in the column organizer add-in.

 

https://community.jmp.com/t5/JMP-Add-Ins/MES-data-retrieval-add-in-Aspentech-IP-21-and-Osisoft-PI-Av...

 

image2.png

jthi
Super User

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

Also most likely breaks this Order Selected Columns (seems to have some bugs even with JMP16).

 

Might have to start adding limitation to add-ins that only specific versions work (will be a hassle to manage with multiple add-ins...).

-Jarmo
FN
FN
Level VI

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

Have you contacted support to check if this change was intended?

jthi
Super User

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

I have but no response just yet.

-Jarmo

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

This was done to fix a crash. Unfortunately, it has proved to have unintended consequences.

 

It isn't sorting the columns by name, it's maintaining their original ordering. No matter how you order columns in the list given to Move Selected Columns(), the moved columns will maintain their original ordering relative to each other. So if you have a table with columns a, b, c, and d, in that order, then both Move Selected Columns({:b, :a}, To Last) and Move Selected Columns({:a, :b}, To Last) will result in the columns being ordered c, b, a, b.

 

As you discovered, an admittedly inconvenient workaround is to issue multiple Move Selected Columns commands. So to get the order c, d, b, a you can call Move Selected Columns({:b}, To Last) then Move Selected Columns({:a}, To Last).

 

This will be fixed.

Pim
Pim
Level II

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

Hi David,

 

I was wondering: has the column sorting issue been fixed?

NRW
NRW
Level IV

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

Jarmo,

 

I just ran into this issue after recently upgrading to JMP 17. This is extremely frustrating since I was moving large column blocks (8 columns / block), with 24 total columns. 

 

I wanted to try your solution, but still not totally understanding your "For Each" statement, even after reviewing scripting index.  So is it basically looking at each element in list, {col}, and moving it to the end of the list?

 

Neil

Neil
jthi
Super User

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

It will move the items to end of list in order (so first one gets moved last as the first one -> ends up first in the end). If you want to do different kind of re-ordering (like re-ordering list of columns in place) the script would require some changes.

 

 

This might have been fixed in JMP17.2, at least I'm getting different result now with my initial script

jthi_0-1699940708360.png

 

 

-Jarmo
NRW
NRW
Level IV

Re: Any idea why Move Selected Columns works with a list was changed in JMP17?

Many thanks Jarmo!

 

I was able to get it working with this snippet as well.

 

list = {:a, :b, :c, :d};
lst_num = NItems(list);

For(kk = 1, kk < list_num, kk++,
		dt << Move Selected Columns({list[kk+1]}, After(list[kk]) );
);
Neil