cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
mvanderaa1
Level IV

saving script to datatable results in very long scripts

Hi, maybe this belong in the "Wish-list" section, but I often find that scripts that I save to a data table become very long and hard to read very quickly. Below an example where I changed a single table to a different number format ({Set Format( "Best", 2 )}). This creates about 16 subsequent individual Dispatch(..) sections, instead of it just being something like:

For col in table.columns:
    Dispatch({"Life Distribution - Compare Groups", "Statistics", "Summary"},
	col,
	NumberColBox,
	{Set Format( "Best", 2 )})

It would be nice if JMP would create a more compact version of the same code.

 

 


dt=Open("$SAMPLE_DATA\big class.jmp");
Life Distribution( Perspective( Compare Groups ), Y( :height ), Grouping( :sex ), Confidence Interval Method( Wald ), Select Distribution( Distribution, Weibull ), Select Scale( Weibull ), Tabbed Report( 0 ), SendToReport( Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Summary"}, "Number failed", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Summary"}, "Left Censor", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Summary"}, "Interval Censored Failure", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Summary"}, "Right Censored", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Summary"}, "Mean", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Summary"}, "Std Error", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Group Homogeneity Tests"}, "ChiSquare", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Group Homogeneity Tests"}, "DF", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Group Homogeneity Tests"}, "Prob>ChiSq", NumberColBox, {Set Format( "Best", 2 ), Set Conditional Format( "" )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Model Comparisons" }, "AICc", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Model Comparisons" }, "-2Loglikelihood", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Model Comparisons" }, "BIC", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Parameter Estimates", "Parametric Estimate - Weibull"}, "Weibull α", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Parameter Estimates", "Parametric Estimate - Weibull"}, "Weibull α CI Lower", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Parameter Estimates", "Parametric Estimate - Weibull"}, "Weibull α CI Upper", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Parameter Estimates", "Parametric Estimate - Weibull"}, "Weibull β", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Parameter Estimates", "Parametric Estimate - Weibull"}, "Weibull β CI Lower", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Statistics", "Parameter Estimates", "Parametric Estimate - Weibull"}, "Weibull β CI Upper", NumberColBox, {Set Format( "Best", 2 )} ), Dispatch( {"Life Distribution - Compare Groups", "Individual Group"}, "", List Box( 2 ), {Set Summary Behavior( "Collapse" )} ), Dispatch( {"Life Distribution - Compare Groups", "Individual Group"}, "", List Box( 75 ), {Set Summary Behavior( "Collapse" )} ) ) )

 

 

1 REPLY 1
pauldeen
Level VI

Re: saving script to datatable results in very long scripts

What you are seeing is just how the language works, luckily you usually do not have to look at your code after you've made it.

 

Maybe you should investigate code folding https://www.jmp.com/support/help/en/16.2/index.shtml#page/jmp/add-code-folding-markers.shtml which should allow you to define SendToReport as a foldable block so that you can collapse it and then you don't have to look at it when editing your scripts.