Subscribe Bookmark RSS Feed

Challenge with JMP scripting: running Distribution platform in a child script called using Include

jacaalgo

Community Trekker

Joined:

May 10, 2013

From a parent script, I am calling another script with the Include statement. This other script, call it child script, generates some output that is appended to output produced by the parent script. The output of the child script includes running the Distribution platform. The first time I run the parent script, the output from the child script is successfully appended to the one from the parent script. The second time I run the same script, after changing one choice that doesn't have anything to do with the distribution, I get the message "A command within the Distribution script was not recognized. No data to analyze", message which I believe is generated if the column variable is passed incorrectly to the Distribution code. Here is my code:

Example = Expr( c = Concat(":", colY << Get Name);

Eval( Substitute( Expr( rdist = Report(ldist = Current Data Table() << Distribution(

Continuous DistributionColumn(_col_), Vertical ( 0 ),

Fit Distribution( Log Normal (Density Curve(1)) ),

Fit Distribution( Normal (Density Curve(1))),

), Histograms Only ) ) ) ,

Expr(_col_),

Parse(c) )

) );

The code runs fine when I run it in isolation from the parent script.

Can someone help me out and tell me what am I doing wrong? Why does it work once, but not the second time around?

2 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

You say that the problem only occurs when you are using an include file - in which case you might need to give example code that clearly illustrates the use of the include file.   Regarding the code you have shown, it seems abit overly complex:

dt = Open("$SAMPLE_DATA/Big Class.jmp");
colY = "height";
ldist = dt << Distribution(
	Continuous Distribution(
		Column( Eval(colY) ),
		Vertical( 0 ),
		Fit Distribution( Log Normal( Density Curve( 1 ) ) ),
		Fit Distribution( Normal( Density Curve( 1 ) ) ),
	),
	Histograms Only
);
rdist = ldist << Report;
-Dave
David_Burnham

Super User

Joined:

Jul 13, 2011

If the code should work then there must be a problem with the contents of one of the variables.  That's hard to track because of the nested operations - you can try separating it a bit like this:

 

c = Concat( ":", colY << Get Name );
show(c);
jsl = Substitute(
		Expr(
			rdist = Report(
				ldist = Current Data Table() << Distribution(
					Continuous Distribution(
						Column( _col_ ),
						Vertical( 0 ),
						Fit Distribution( Log Normal( Density Curve( 1 ) ) ),
						Fit Distribution( Normal( Density Curve( 1 ) ) ),

					),
					Histograms Only
				)
			)
		),
	Expr( _col_ ), Parse( c )
);
show(jsl);

You can inspect the jsl variable in the log window to make sure it is well-formed (if it is then if you select the text, right-click, and select run script, it should execute correctly.

 

-Dave