cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
msharp
Super User (Alumni)

Highlight Cell in Data Table Box

I want to highlight significant PValues in a Data Table Box.  I have a display where I simply run a Response Screening then save the data table to the display along with a Graph Builder plot via:  vlb << Append(dtb = Data Table Box(dt));

 

I can't seem to figure out an easy way to edit the Data Table Box.  I tried highlighting the value on the actual table before import into the display but it didn't do anything. Any suggestions?

 

DataTableBoxHighlight.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User (Alumni)

Re: Highlight Cell in Data Table Box

Duh, sorry I JMPed in too early.  But just in case that's the only route that'll give you the formatting, here is a utility:

Data Table To Table Box = Function({dt},{Default Local},
	tb = Table Box();
	For (i=1,i<=NCols(dt),i++,
		col = Column(dt,i);
		colName = col << Get Name;
		lstValues = col << Get Values;
		type = col << Get Data Type;
		If (type=="Character",
			tb << Append(
				String Col Box(colName,lstValues)
			)
		,
			tb << Append(
				Number Col Box(colName,lstValues)
			)
		);
	);
	// return
	tb
);
-Dave

View solution in original post

6 REPLIES 6
David_Burnham
Super User (Alumni)

Re: Highlight Cell in Data Table Box

I'm not sure if there is a way to change the background colour, but you can apply conditional p-value formatting:

NumberColBox("p-value",EvalList({p}),<<Set Format(10,97),<<Set Conditional Format("PValue")),

 

-Dave
msharp
Super User (Alumni)

Re: Highlight Cell in Data Table Box

This doesn't look like a solution for a Data Table Box?

David_Burnham
Super User (Alumni)

Re: Highlight Cell in Data Table Box

Duh, sorry I JMPed in too early.  But just in case that's the only route that'll give you the formatting, here is a utility:

Data Table To Table Box = Function({dt},{Default Local},
	tb = Table Box();
	For (i=1,i<=NCols(dt),i++,
		col = Column(dt,i);
		colName = col << Get Name;
		lstValues = col << Get Values;
		type = col << Get Data Type;
		If (type=="Character",
			tb << Append(
				String Col Box(colName,lstValues)
			)
		,
			tb << Append(
				Number Col Box(colName,lstValues)
			)
		);
	);
	// return
	tb
);
-Dave
msharp
Super User (Alumni)

Re: Highlight Cell in Data Table Box

Beautiful, I think I can take it from here along with your previous comment.  It's unfortuneate the Data Table Box() isn't a Table Box().  All the documentations say it is, but when I dig into the properties I feel very limited in my options for customization.

 

Thanks for the elegant function!  Not sure why I didn't think of it.  That's what community is for!

Re: Highlight Cell in Data Table Box

If you are OK with not having the live link to the data table like the DataTableBox has, the Get As Report message should do you just fine.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:Age << Color Cells( "Red" );

New Window("Colored cells",
	dt << get as report()
);

Capture.PNG

Justin
msharp
Super User (Alumni)

Re: Highlight Cell in Data Table Box

Thanks for sharing!  This is actually a better solution to my specific problem.  However, I'm going to leave David's answer as correct since I believe it's more robust.