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
Black_Wheel
Level II

How to send updates from data table to display widget?

Hi everyone,

 

Need your help to solve the problems below (code attached).

1. I have a widget that users can key in info and then the "Submit" button is hit, the data is saved into the pre-defined data table successfully. However, I can not make the display table on the widget get updated.

 

2. For example, users submit 5 rows of data and the second row is transcripted incorrectly then I want to create a "Delete" button but still have no ideas how to pick the right row to delete (on widget).

 

 

 

data_input = Expr( 

dt = New Table( "Data Table",	
	Invisible,
	New Column( "Sequence",
		Numeric,
		Formula(Sequence(1,99,1))
	),	
	New Column( "Col1",
		Numeric,
		"Continuous",
		Format( "d/m/y h:m:s" ),
		Input Format( "d/m/y h:m:s" ),
	),
	New Column( "Col2",
		Character,
		"Nominal"
	),	
	New Column( "Col3",
		Character,
	),	
	New Column( "Col4",
		Character,
	),
	New Column( "Col5",
		Character,
		"Nominal"
	),
	New Column( "Col6",
		Character,
		"Nominal"
	),
	New Column( "Col7",
		Character,
		"Nominal"
	),
	New Column( "Col8",
		Character,
		"Nominal"
	),	
	New Column( "Col9",
		Numeric,
		Format( "h:m" )
	),
	New Column( "Col10",
		Numeric,
		Format( "h:m" )
	),				
);
	
);


buffer = Expr(

Data1 = {"A", "B", "C", "D", "E", "F"};
co1 = Data1[nw["t2"]];
	
);


graphic = Expr(
nw = New Window( " Records ",
	<<Modal,
	<<Return Result,
	olb1 = Outline Box( "Record Panel",
	H List Box(
		Panel Box( " Time ",  
			t1 = Calendar Box(<<Background Color( White ));	
		),
		Spacer Box(Size(30,0)),
		V List Box(
			Panel Box( " Data 1 ",
				t2 = Radio Box( {"A", "B", "C", "D", "E", "F"} )
			),
			Spacer Box(Size(0,12)),			
		),
		Spacer Box(Size(30,0)),	
		Spacer Box(Size(30,0)),
		V List Box(
			Panel Box( " Note 1 ", 
				t3 = Text Edit Box( " Note ... ", << Set Width( 200 ), SetNLines( 5 ) 
				)
			),
			Spacer Box(Size(0,12)),
			Panel Box( " Note 2 ", 
				t4 = Text Edit Box( " Note ... ", << Set Width( 200 ), SetNLines( 5 ) 
				)
			),
			subt = Button Box("Submit",
				t1 = t1 <<Get Date;
				t3 = t3 <<Get Text;
				t4 = t4 <<Get Text;
				dt << Add Rows({:Col1 = t1, :Col2 = co1, :Col3 = t3, :Col4 = t4})
			)				
		),		
	),
	),
	Spacer Box(Size(0,10)),
	olb2 = Outline Box( "Draft Records",
		Panel Box( "", 
					dt << Get As Report()	
		),
	);
);

buffer;

);

//Main

data_input;
graphic;

 

Good Day,

 

1 REPLY 1
Highlighted
gzmorgan0
Super User

Re: How to send updates from data table to display widget?

@Black_Wheel ,

 

There are several methods to do this:

  • dt << Get As Report , you the scripter needs update the report with each addition and for a deletion, script get the selected row, delete from the underlying table and update the display.  The report is independent of the table, and teh scripter manages the view.
  • dt << New Data Box() the view is linked to the data table. So to delete or edit a row the user just deletes or edits it.

There is another method creating a Table Box using DataTableColBox() however, I encountered an error when using Get Selected Rows(), which I have reported to JMP.

 

I have attached a modified version of your script using the first method dt << Get As Report.  Note some cahnges:

  • commented out << Modal and  << Return Results, the invisible table seems to be the result.
  • added a VScrollBox() container for the display table 
  • made selected row color red (see screen shot below)

 

 

image.png

Article Labels

    There are no labels assigned to this post.