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
Neo
Neo
Level VI

How to get Caption Box values in a datatable?

In the attached made up example data table the saved script plots the chart pasted below.

I would like to get the Caption Box values in a data table with TestStage numbers in the first column and the Caption Box Values in the second column. How to do this via JSL?

It would be even more useful if I could generate the data table dynamically, say from a button click in the graph builder window once I have selected the weeks via the Local Data Filter. Is this possible to do via JSL?

 

Neo_0-1718098659379.png

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to get Caption Box values in a datatable?

You could use separate tabulate for that

jthi_0-1718383831274.png

View more...
Names Default To Here(1);

dt = Open("$DOWNLOADS/example_DataTable.jmp");

nw = New Window("",
	Data Filter Context Box(
		H List Box(
			dt << Data Filter(Local,
				Add Filter(
					columns(:TestWk),
					Modeling Type(:TestWk, Nominal),
					Where(
						:TestWk == {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
					),
					Display(:TestWk, Find(Set Text("")))
				)
			),
			V List Box(
				gb = dt << Graph Builder(
					Size(744, 332),
					Show Control Panel(0),
					Variables(X(:TestWk), Y(:Median), Group Y(:TestStage)),
					Elements(
						Points(X, Y, Legend(8)),
						Caption Box(X, Y, Legend(10), Summary Statistic("N"))
					),
					SendToReport(Dispatch({}, "TestWk", ScaleBox, {Label Row(Show Major Grid(1))}))
				),
				tab2 = dt << Tabulate(Show Control Panel(0), Add Table(Column Table(Statistics(N))))
			),
			tab = dt << Tabulate(
				Change Item Label(Statistics(N, "Die tested")),
				Show Control Panel(0),
				Add Table(Column Table(Statistics(N)), Row Table(Grouping Columns(:TestStage)))
			)
		)
	)
);
wait(0);
(nw << XPath("//TextBox[contains(text(), 'Where(')]")) << Visibility("Collapse");

 

-Jarmo

View solution in original post

7 REPLIES 7
jthi
Super User

Re: How to get Caption Box values in a datatable?

Have you considered using Tabulate?

Names Default To Here(1);

dt = Open("$DOWNLOADS/example_DataTable.jmp");

nw = New Window("",
	Data Filter Context Box(
		H List Box(
			dt << Data Filter(Local,
				Add Filter(
					columns(:TestWk),
					Modeling Type(:TestWk, Nominal),
					Where(
						:TestWk == {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
					),
					Display(:TestWk, Find(Set Text("")))
				)
			),
			gb = dt << Graph Builder(
				Size(744, 332),
				Show Control Panel(0),
				Variables(X(:TestWk), Y(:Median), Group Y(:TestStage)),
				Elements(
					Points(X, Y, Legend(8)),
					Caption Box(X, Y, Legend(10), Summary Statistic("N"))
				),
				SendToReport(Dispatch({}, "TestWk", ScaleBox, {Label Row(Show Major Grid(1))}))
			),
			tab = dt << Tabulate(Show Control Panel(0), Add Table(Row Table(Grouping Columns(:TestStage))))
		)
	)
);

If this isn't enough you could add button to turn the tabulate into data table (and make tabulate hidden if necessary).

-Jarmo
Neo
Neo
Level VI

Re: How to get Caption Box values in a datatable?

@jthi  Thanks, I got your suggestion to work for my actual case. I would like to control two more things if this is possible. 

How to change the "N"  (blue arrow) on the table to something like "die tested"?

How to remove the text below the chart and the tabulated table (circled in red below)?

 

Also, how to get the sum of "N"?

Neo_0-1718291961479.png

 

When it's too good to be true, it's neither
jthi
Super User

Re: How to get Caption Box values in a datatable?

I'm not sure how to easily keep that hidden from tabulate as it seems to re-create it based on something (when you have too large Where statement it adds it back or something weird). You can do it with filter change handler but I would try to avoid that as much as possible (I would rather keep that Where text than start messing with those).

Names Default To Here(1);

dt = Open("$DOWNLOADS/example_DataTable.jmp");

nw = New Window("",
	Data Filter Context Box(
		H List Box(
			dt << Data Filter(Local,
				Add Filter(
					columns(:TestWk),
					Modeling Type(:TestWk, Nominal),
					Where(
						:TestWk == {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
					),
					Display(:TestWk, Find(Set Text("")))
				)
			),
			gb = dt << Graph Builder(
				Size(744, 332),
				Show Control Panel(0),
				Variables(X(:TestWk), Y(:Median), Group Y(:TestStage)),
				Elements(
					Points(X, Y, Legend(8)),
					Caption Box(X, Y, Legend(10), Summary Statistic("N"))
				),
				SendToReport(Dispatch({}, "TestWk", ScaleBox, {Label Row(Show Major Grid(1))}))
			),
			tab = dt << Tabulate(
				Change Item Label(Statistics(N, "Die tested")),
				Show Control Panel(0),
				Add Table(Column Table(Statistics(N)), Row Table(Grouping Columns(:TestStage)))
			)
		)
	)
);
wait(0);
(nw << XPath("//TextBox[contains(text(), 'Where(')]")) << Visibility("Collapse");
-Jarmo
Neo
Neo
Level VI

Re: How to get Caption Box values in a datatable?

@jthi Thanks, I do not mind the where statements in JMP, but when copying the chart onto other windows apps, I would have preferred not to have them.

 

Is it possible to display the sum of "N" (i.e. Total Die Tested)  below the table?

 

 

When it's too good to be true, it's neither
jthi
Super User

Re: How to get Caption Box values in a datatable?

You can add extra V List Box to wrap graph builder and tabulate

jthi_0-1718296299008.png

View more...
Names Default To Here(1);

dt = Open("$DOWNLOADS/example_DataTable.jmp");

nw = New Window("",
	Data Filter Context Box(
		H List Box(
			dt << Data Filter(Local,
				Add Filter(
					columns(:TestWk),
					Modeling Type(:TestWk, Nominal),
					Where(
						:TestWk == {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
					),
					Display(:TestWk, Find(Set Text("")))
				)
			),
			V List Box(
				gb = dt << Graph Builder(
					Size(744, 332),
					Show Control Panel(0),
					Variables(X(:TestWk), Y(:Median), Group Y(:TestStage)),
					Elements(
						Points(X, Y, Legend(8)),
						Caption Box(X, Y, Legend(10), Summary Statistic("N"))
					),
					SendToReport(Dispatch({}, "TestWk", ScaleBox, {Label Row(Show Major Grid(1))}))
				),
			)
		)
	)
);
-Jarmo
Neo
Neo
Level VI

Re: How to get Caption Box values in a datatable?

@jthiThanks, but do not get the V List box in my JMP 16 using your script.

Also, what I mean as as sum is a value of 14 (2+2+3+3+2+2) displayed on the chart, in this case.

When it's too good to be true, it's neither
jthi
Super User

Re: How to get Caption Box values in a datatable?

You could use separate tabulate for that

jthi_0-1718383831274.png

View more...
Names Default To Here(1);

dt = Open("$DOWNLOADS/example_DataTable.jmp");

nw = New Window("",
	Data Filter Context Box(
		H List Box(
			dt << Data Filter(Local,
				Add Filter(
					columns(:TestWk),
					Modeling Type(:TestWk, Nominal),
					Where(
						:TestWk == {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
					),
					Display(:TestWk, Find(Set Text("")))
				)
			),
			V List Box(
				gb = dt << Graph Builder(
					Size(744, 332),
					Show Control Panel(0),
					Variables(X(:TestWk), Y(:Median), Group Y(:TestStage)),
					Elements(
						Points(X, Y, Legend(8)),
						Caption Box(X, Y, Legend(10), Summary Statistic("N"))
					),
					SendToReport(Dispatch({}, "TestWk", ScaleBox, {Label Row(Show Major Grid(1))}))
				),
				tab2 = dt << Tabulate(Show Control Panel(0), Add Table(Column Table(Statistics(N))))
			),
			tab = dt << Tabulate(
				Change Item Label(Statistics(N, "Die tested")),
				Show Control Panel(0),
				Add Table(Column Table(Statistics(N)), Row Table(Grouping Columns(:TestStage)))
			)
		)
	)
);
wait(0);
(nw << XPath("//TextBox[contains(text(), 'Where(')]")) << Visibility("Collapse");

 

-Jarmo