cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
ih
Super User (Alumni) ih
Super User (Alumni)

Easy and intuitive editing of multiple cells in data table within a custom window

Is there a way to allow users to select, or appear to select, multiple cells in a Table Box, or is there a different object I could use instead? To illustrate the use case, a user might want to move the pump tags from the left table to the right starting on row 2 in the image below. How would they select the block of cells to copy and then paste them?

table copy paste.png

View more...
New Window( "Editing a data table",
	Show Menu( 0 ), Show Toolbars( 0 ),
	h list box(
		Table Box(
			String Col Edit Box( "PI Point", Repeat( { "" }, 5 ) || Transform Each({v},as list(transpose(1::15)),"Pump1-" || char(v)) ),
			String Col Edit Box( "Friendly Name", Repeat( { "" }, 5 ) || Transform Each({v},as list(transpose(1::15)),"Name " || char(v)) )
		),
		spacer box(20,20),
		Table Box(
			String Col Edit Box( "PI Point", {"sinusoid"} || Repeat( { "" }, 14 ) || {"Valve1", "Valve2", "Valve3"} ),
			String Col Edit Box( "Friendly Name", Repeat( { "" }, 15) || {"Inlet", "Outlet", "Recirc"} )
		)
	)
);

Scripting the copying and pasting the values should be straight forward, but the user needs to indicate where to get data and where to put it.

The Actual Use Case

I want to improve the Aveva/OSISoft PI Tools add-in interface by replacing the text box entry for tags and friendly names with a data table, as discussed on an issue in github.  Often users have a list tags in a JMP table or a spreadsheet, and they want to quickly copy/paste them into the add-in user interface.  Simply copying the entire table at once is easy enough, but then if a change is needed they might want to just replace a section of the list.

With the Table Box object it doesn't appear a user can select multiple cells, is there another option here?  At one time I thought you could embed an entire data table window inside of a user defined window, but maybe I dreamt that.

So far my best idea is some sort of mouseover logic that draws squares over 'selected' cells, but I first want to see if there is a simpler solution.

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XIII

Re: Easy and intuitive editing of multiple cells in data table within a custom window

The command is << new data box:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
new window("data box", dt << new data box)

View solution in original post

2 REPLIES 2
hogi
Level XIII

Re: Easy and intuitive editing of multiple cells in data table within a custom window

The command is << new data box:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
new window("data box", dt << new data box)
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Easy and intuitive editing of multiple cells in data table within a custom window

Thanks @hogi that is it!!

These provide a pretty good user experience I think.

table copy paste with new table box.png

Code to reproduce:

View more...
names default to here(1);

dt1 = New Table( "dt1", invisible,
	Add Rows( 20 ),
	New Column( "PI Point", Character, "Nominal", Set Values(
		Repeat( { "" }, 5 ) || Transform Each({v},as list(transpose(1::15)),"Pump1-" || char(v))
	) ),
	New Column( "Friendly Name", Character, "Nominal", Set Values( 
		Repeat( { "" }, 5 ) || Transform Each({v},as list(transpose(1::15)),"Name " || char(v))
	) )
);

dt2 = New Table( "dt1", invisible,
	Add Rows( 20 ),
	New Column( "PI Point", Character, "Nominal", Set Values(
		{"sinusoid"} || Repeat( { "" }, 14 ) || {"Valve1", "Valve2", "Valve3"}
	) ),
	New Column( "Friendly Name", Character, "Nominal", Set Values( 
		Repeat( { "" }, 15) || {"Inlet", "Outlet", "Recirc"}
	) )
);

new window("data box",
	Show Menu( 0 ), Show Toolbars( 0 ),
	h list box(
		ntb1 = dt1 << New Data Box;
		ntb1 << close side panels;
		ntb1 << Set Row ID Width( 50 );
		ntb1 << Set Width(200);
		ntb1 << Set Height(450);
		ntb1,
		spacer box( Size( 20, 20 )),
		ntb2 = dt2 << New Data Box;
		ntb2 << close side panels;
		ntb2 << Set Row ID Width( 50 );
		ntb2 << Set Width(200);
		ntb2 << Set Height(450);
		ntb2
	),
	<< On close(
		try( dt1 << Close Window );
		try( dt2 << Close Window );
	)
);

I am still working through some aspects of these - like how to resize the column width inside that box after the table is drawn - but that is for another day!

Recommended Articles