cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. ET on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

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

Correct syntax for argument in Report ()

I am on JMP13 and I understand from here that I cannot have multiple outputs from a function unless I use lists. So I have put together the following script and it works as expected. 

Names Default To Here (1);
delete symbols ();
clear log ();
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

getDistChart = Function({ColName, _LSL, _USL}, {distChart},

New Window(""||ColName||" distribution",

		distChart1 = dt <<Distribution(
			Stack( 1 ),
			Automatic Recalc( 1 ),
			Continuous Distribution(
				Column( :weight ),
				Horizontal Layout( 1 ),
				Vertical( 0 )
			),
			Local Data Filter(
				Close Outline( 1 ),
				Add Filter( columns( :sex ), Where( :sex == "M" ) )
			)
		);

		distChart2 = dt << Distribution(
			Stack( 1 ),
			Continuous Distribution(
				Column(As Column (ColName) ),
				Horizontal Layout( 1 ),
				Vertical( 0 ),
				Capability Analysis( LSL(_LSL ), USL(_USL) )
			),
			SendToReport(
				Dispatch(
					{},
					"Distrib Histogram",
					FrameBox,
					{DispatchSeg( LabelSeg( 1 ), {Font( "Segoe UI", 7, "Plain" )} ),
					DispatchSeg( LabelSeg( 2 ), {Font( "Segoe UI", 7, "Plain" )} )}
				)
			)
		);

);

op = {distChart1, distChart2};
return (op);

);
dist =  getDistChart ("weight", 55, 185); 
dist1 = dist [1];
dist2 = dist [2];

toPass= Report(dist1)[Outline Box("weight" ), Outline Box( "Summary Statistics" ), Table Box( 1 ), Number Col Box(1)]<< get (1); 

However, the following does not work

toPass= Report(dist[1])[Outline Box("weight" ), Outline Box( "Summary Statistics" ), Table Box( 1 ), Number Col Box(1)]<< get (1);

and I am wondering if I am making a mistake in the syntax for using an argument in Report()?

 

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

Accepted Solutions
jthi
Super User

Re: Correct syntax for argument in Report ()

Try adding Eval List inside your function:

op = EvalList({distChart1, distChart2});
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Correct syntax for argument in Report ()

Try adding Eval List inside your function:

op = EvalList({distChart1, distChart2});
-Jarmo
txnelson
Super User

Re: Correct syntax for argument in Report ()

I suspect that JMP is interpreting the syntax incorrectly since 

report( dist[1] )

is the syntax to reference a second report branch when a second variable or a By is specified in the platform.

I have been able to use a workaround to do what you want, using an Eval() function

toPass= Report( Eval( dist[1] ) )[Outline Box("weight" ), Outline Box( "Summary Statistics" ), Table Box( 1 ), Number Col Box(1)]<< get (1);

 

Jim

Recommended Articles