cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
EMDLEB
Level I

Shift multiple rows selection 1 up JSL

Hello, 

 

This is my first post! 

Is there a way to shift the rows selection 1 up in JSL? 

 

Example: selected rows are 5,9,10

shift selection up will select rows 4,8,9

 

This is done is VS as follows:

Sub moveselection()
Selection.Offset(1, 0).Select
End Sub

 

1 REPLY 1
jthi
Super User

Re: Shift multiple rows selection 1 up JSL

This will require some additional error check for 0 row which depends how you want to handle it (do you want to loop it around for example):

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(10),
	New Column("Column 1",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([., ., ., ., ., ., ., ., ., .])
	),
	Set Row States([0, 0, 0, 0, 1, 0, 0, 0, 1, 1])
);
wait(1);
sel_rows = dt << Get Selected Rows;
dt << Clear Select;
dt << Select Rows(sel_rows - 1);

Or you could possibly use row states.

 

Edit:

With row states it could be something like this (only works this way if Selection/no state are only row states):

dt << Set Row States((dt << Get Row States)[2::NRows(dt)] |/ [0]);
-Jarmo