cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Haelavot
Level I

printing variable to textbox in variability chart

when i run the following script, the charts are producted for each sample, however the textbox print sampleName instead of actually printing the value of the sample name.  how do i get around this?
 
thanks!
 
// Create a new window with variability charts for each sample name
New Window("whiteshirts - Variability Chart",
	V List Box(
		Current Data Table(summaryTable);
		For Each Row(
			summaryTable,
			sampleName = Column(summaryTable, "SAMPLE_NAME")[Row()];
			grandMin = Column(summaryTable, "Min(LAB_L)")[Row()];
			grandMax = Column(summaryTable, "Max(LAB_L)")[Row()];
			Print(sampleName, grandMin, grandMax);
 
            /*Text Box( "Where(:SAMPLE_NAME == " || char(sampleName) || ")", <<Set Wrap( 1903 ) );*/
			Text Box(Char(sampleName));
			Print("sampleName is " || sampleName);
			Data Table("whiteshirtsall") << Variability Chart(
				Y(:LAB_L),
				Model("Main Effect"),
				X(:shirt),
				Variability Analysis(
					:LAB_L,
					Std Dev Chart(0),
					AIAG Labels(0),
					Show Box Plots(1)
				),
				Where(:SAMPLE_NAME == sampleName),
				SendToReport(
					Dispatch(
						{"Variability Gauge Analysis for LAB_L", "Variability Chart for LAB_L"},
						"2", ScaleBox,
						{Add Ref Line(grandMin, "Solid", "Medium Dark Red", "", 2),
						Add Ref Line(grandMax, "Solid", "Medium Dark Red", "", 2),
						Label Row({Show Major Grid(1), Show Minor Grid(1)})}
					)
				)
			);
		);
	)
);
Edit 2024-09-05 jthi: added jsl formatting
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: printing variable to textbox in variability chart

The text used in filter isn't being evaluated so it will be left as sampleName. Here is one way how you could evaluate it

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

Column(dt, 2) << Set Name("shirt");
Column(dt, 3) << Set Name("SAMPLE_NAME");
Column(dt, 4) << Set Name("LAB_L");

dt_summary = dt << Summary(
	Group(:SAMPLE_NAME),
	Min(:LAB_L),
	Max(:LAB_L),
	Freq("None"),
	Weight("None"),
	Link to original data table(0),
	output table name("Summary of Big Class grouped by SAMPLE_NAME")
);


nw = New Window("whiteshirts - Variability Chart",
	V List Box(
		For Each Row(
			dt_summary,
			sampleName = Column(dt_summary, "SAMPLE_NAME")[Row()];
			grandMin = Column(dt_summary, "Min(LAB_L)")[Row()];
			grandMax = Column(dt_summary, "Max(LAB_L)")[Row()];
			Print(sampleName, grandMin, grandMax);
 
            /*Text Box( "Where(:SAMPLE_NAME == " || char(sampleName) || ")", <<Set Wrap( 1903 ) );*/
			Print("sampleName is " || sampleName);
			Eval(EvalExpr(
				dt << Variability Chart(
					Y(:LAB_L),
					Model("Main Effect"),
					X(:shirt),
					Variability Analysis(
						:LAB_L,
						Std Dev Chart(0),
						AIAG Labels(0),
						Show Box Plots(1)
					),
					Where(:SAMPLE_NAME == Expr(sampleName)),
					SendToReport(
						Dispatch(
							{"Variability Gauge Analysis for LAB_L", "Variability Chart for LAB_L"},
							"2", ScaleBox,
							{Add Ref Line(grandMin, "Solid", "Medium Dark Red", "", 2),
							Add Ref Line(grandMax, "Solid", "Medium Dark Red", "", 2),
							Label Row({Show Major Grid(1), Show Minor Grid(1)})}
						)
					)
				);
			));
		);
	)
);

jthi_0-1725536855554.png

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: printing variable to textbox in variability chart

The text used in filter isn't being evaluated so it will be left as sampleName. Here is one way how you could evaluate it

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

Column(dt, 2) << Set Name("shirt");
Column(dt, 3) << Set Name("SAMPLE_NAME");
Column(dt, 4) << Set Name("LAB_L");

dt_summary = dt << Summary(
	Group(:SAMPLE_NAME),
	Min(:LAB_L),
	Max(:LAB_L),
	Freq("None"),
	Weight("None"),
	Link to original data table(0),
	output table name("Summary of Big Class grouped by SAMPLE_NAME")
);


nw = New Window("whiteshirts - Variability Chart",
	V List Box(
		For Each Row(
			dt_summary,
			sampleName = Column(dt_summary, "SAMPLE_NAME")[Row()];
			grandMin = Column(dt_summary, "Min(LAB_L)")[Row()];
			grandMax = Column(dt_summary, "Max(LAB_L)")[Row()];
			Print(sampleName, grandMin, grandMax);
 
            /*Text Box( "Where(:SAMPLE_NAME == " || char(sampleName) || ")", <<Set Wrap( 1903 ) );*/
			Print("sampleName is " || sampleName);
			Eval(EvalExpr(
				dt << Variability Chart(
					Y(:LAB_L),
					Model("Main Effect"),
					X(:shirt),
					Variability Analysis(
						:LAB_L,
						Std Dev Chart(0),
						AIAG Labels(0),
						Show Box Plots(1)
					),
					Where(:SAMPLE_NAME == Expr(sampleName)),
					SendToReport(
						Dispatch(
							{"Variability Gauge Analysis for LAB_L", "Variability Chart for LAB_L"},
							"2", ScaleBox,
							{Add Ref Line(grandMin, "Solid", "Medium Dark Red", "", 2),
							Add Ref Line(grandMax, "Solid", "Medium Dark Red", "", 2),
							Label Row({Show Major Grid(1), Show Minor Grid(1)})}
						)
					)
				);
			));
		);
	)
);

jthi_0-1725536855554.png

 

-Jarmo

Recommended Articles