BookmarkSubscribe
Choose Language Hide Translation Bar
tom_abramov
Community Trekker

Redo cancels <<report actions

Hi,

If I run some report changes in the script and then run excluding of some rows with Autorecalc on,

all report changes disappear.

How do I insert all report changes into the body of distribution, so they will not disappear?

Thanks.

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
Automatic Recalc( 1 ),
Continuous Distribution(
Quantiles(0),
Summary Statistics(1),
Column( :weight ),
Horizontal Layout( 1 ),
Ppk Capability Labeling(1),
Capability Analysis( LSL( 80 ), USL( 140 ) )
));
PpkValue = (dist << report)[OutlineBox("Long Term Sigma")][NumberColBox(1)][2];
PPKtb = Table Box(
String Col Box( "Parameter", {"Ppk"} ),
Number Col Box( "Value", {PpkValue} )
);
(dist << report)[OutlineBox("Summary Statistics")] << Append(PPKtb);
(dist << report)[OutlineBox("Long Term Sigma")] << Delete;

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Redo cancels <<report actions

My script was intended to give you a pointer towards possible methods that could be used, with the hope that it would provide sufficient insight.  I hope I can improve on my input with the following:

I did not mention 2 methods in my previous response.  I mentioned 3 methods, Filter Change Handler, RowState Handler and Add Graphics Script.  Given the particulars of what you need, you may choose to use any one of the different options.  I have provided 2 scripts below, one using the RowState Handler, and the other using the Add Graphics Script.  

 

The RowState Handler is very similar to the implementation of the Filter Change Handler.  Using it, the changes are triggered if any changes are made to the RowState column in the data table.

names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
	Automatic Recalc( 1 ),
	Continuous Distribution(
		Quantiles( 0 ),
		Summary Statistics( 1 ),
		Column( :weight ),
		Horizontal Layout( 1 ),
		Ppk Capability Labeling( 1 ),
		Capability Analysis( LSL( 80 ), USL( 140 ) )
	)
);

addit = Function({},
PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
(dist << report)["Summary Statistics"] << Append( PPKtb );
(dist << report)["Long Term Sigma"] << delete;);

f = Function( {a}, addit() );
rs = dt << Make RowState Handler( f );

addit();

The Add Graphics example iis more complex.  This is primarily, because the script writer has to determine what items need to be compared to then trigger the code to be run.  In the below case, the checking to see if the mean or standard deviation changes, triggers the running of the code.  That may not be sufficient, for the kinds of things your users might be changing...so that made need to be expanded or completly changed.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
	Automatic Recalc( 1 ),
	Continuous Distribution(
		Quantiles( 0 ),
		Summary Statistics( 1 ),
		Column( :weight ),
		Horizontal Layout( 1 ),
		Ppk Capability Labeling( 1 ),
		Capability Analysis( LSL( 80 ), USL( 140 ) )
	)
);

addit = Function( {},
	PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
	PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
	(dist << report)["Summary Statistics"] << Append( PPKtb );
	(dist << report)["Long Term Sigma"] << delete;
);

theMean = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1];
theSTD = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2];

(dist << report)[framebox( 2 )] << add graphics script(
	If(
		theMean != ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1] | theSTD != ((dist
		 << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2],
		addit()
	);
	theMean = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1];
	theSTD = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2];
);

addit();

I strongly suggest that you take the time to read the Scripting Guide, and to familiarize yourself with the Scripting Index.  The overview of JSL in the Scripting Guide provides the foundation one needs to be a proficient JSL programmer, and the examples for all of the objects and functions in the Scripting Index are invaluable in writing the code

Jim
6 REPLIES 6
txnelson
Super User

Re: Redo cancels <<report actions

I believe, your syntax is off a bit.  Change the references to to following, and it works fine

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
	Automatic Recalc( 1 ),
	Continuous Distribution(
		Quantiles( 0 ),
		Summary Statistics( 1 ),
		Column( :weight ),
		Horizontal Layout( 1 ),
		Ppk Capability Labeling( 1 ),
		Capability Analysis( LSL( 80 ), USL( 140 ) )
	)
);
PpkValue = (dist << report)[Outline Box( "Long Term Sigma" )][Number Col Box( 1 )][2];
PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
(dist << report)["Summary Statistics"] << Append( PPKtb );
(dist << report)["Long Term Sigma"] << delete;
Jim
0 Kudos
tom_abramov
Community Trekker

Re: Redo cancels <<report actions

Thank you.

It does work fine, but when I exclude one row, all report changes disappear.

What do you mean by "Change the references to to following"?

Please see attached the picture.

0 Kudos
txnelson
Super User

Re: Redo cancels <<report actions

When you do a Recalc, the platform is effectively rerun, thus all of your post modifications need to also be rerun.  One way to do this, is to use a filter change handler or a row state handler, which will run code, when a change in the filter or the row states are detected.  You can also add a Graphics Script to the Frame Box() in the distribution graphic to trigger the execution of code when the graph changes.  The code below uses a Make Filter Change Handler() to get the job done

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
	Automatic Recalc( 1 ),
	Continuous Distribution(
		Quantiles( 0 ),
		Summary Statistics( 1 ),
		Column( :weight ),
		Horizontal Layout( 1 ),
		Ppk Capability Labeling( 1 ),
		Capability Analysis( LSL( 80 ), USL( 140 ) )
	)
);

addit = Function({},
PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
(dist << report)["Summary Statistics"] << Append( PPKtb );
(dist << report)["Long Term Sigma"] << delete;);

filter = dist << Local Data Filter(
	Add Filter( columns( :age ) )
);
f = Function( {a}, addit() );
rs = filter << Make Filter Change Handler( f );

addit();

 

Jim
0 Kudos
tom_abramov
Community Trekker

Re: Redo cancels <<report actions

Thanks Jim.

Unfortunately, this solution is not good for me.

1. I don't want to add local data filter

2. When I run your script and change the selection in local data filter, the distribution reruns without custom report changes.

 

What is the syntax of your second solution (Graphics Script to the Frame Box())?

 

Thanks again.

 

 

 

0 Kudos
txnelson
Super User

Re: Redo cancels <<report actions

My script was intended to give you a pointer towards possible methods that could be used, with the hope that it would provide sufficient insight.  I hope I can improve on my input with the following:

I did not mention 2 methods in my previous response.  I mentioned 3 methods, Filter Change Handler, RowState Handler and Add Graphics Script.  Given the particulars of what you need, you may choose to use any one of the different options.  I have provided 2 scripts below, one using the RowState Handler, and the other using the Add Graphics Script.  

 

The RowState Handler is very similar to the implementation of the Filter Change Handler.  Using it, the changes are triggered if any changes are made to the RowState column in the data table.

names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
	Automatic Recalc( 1 ),
	Continuous Distribution(
		Quantiles( 0 ),
		Summary Statistics( 1 ),
		Column( :weight ),
		Horizontal Layout( 1 ),
		Ppk Capability Labeling( 1 ),
		Capability Analysis( LSL( 80 ), USL( 140 ) )
	)
);

addit = Function({},
PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
(dist << report)["Summary Statistics"] << Append( PPKtb );
(dist << report)["Long Term Sigma"] << delete;);

f = Function( {a}, addit() );
rs = dt << Make RowState Handler( f );

addit();

The Add Graphics example iis more complex.  This is primarily, because the script writer has to determine what items need to be compared to then trigger the code to be run.  In the below case, the checking to see if the mean or standard deviation changes, triggers the running of the code.  That may not be sufficient, for the kinds of things your users might be changing...so that made need to be expanded or completly changed.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
	Automatic Recalc( 1 ),
	Continuous Distribution(
		Quantiles( 0 ),
		Summary Statistics( 1 ),
		Column( :weight ),
		Horizontal Layout( 1 ),
		Ppk Capability Labeling( 1 ),
		Capability Analysis( LSL( 80 ), USL( 140 ) )
	)
);

addit = Function( {},
	PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
	PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
	(dist << report)["Summary Statistics"] << Append( PPKtb );
	(dist << report)["Long Term Sigma"] << delete;
);

theMean = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1];
theSTD = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2];

(dist << report)[framebox( 2 )] << add graphics script(
	If(
		theMean != ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1] | theSTD != ((dist
		 << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2],
		addit()
	);
	theMean = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1];
	theSTD = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2];
);

addit();

I strongly suggest that you take the time to read the Scripting Guide, and to familiarize yourself with the Scripting Index.  The overview of JSL in the Scripting Guide provides the foundation one needs to be a proficient JSL programmer, and the examples for all of the objects and functions in the Scripting Index are invaluable in writing the code

Jim
Highlighted
tom_abramov
Community Trekker

Re: Redo cancels <<report actions

Thank you!
"Add graphics script" will work fine for me!