BookmarkSubscribe
Choose Language Hide Translation Bar
UberBock
Occasional Contributor

Control Chart Scripting Question

So I have this

dt << newColumn("FlatPeak", "numeric", "continuous",setFormula(If( :DISPENSESPEED == 1550,
Maximum( :R050, :R051, :R052, :R053, :R054, :R055, :R056, :R057, :R058, :R059,:R060) * 1000,
.
)
));

 

Can I somehow use

 

dt << newColumn("FlatPeak", "numeric", "continuous",setFormula(If( :DISPENSESPEED == 1550,
Maximum( :R050 : :R060) * 1000,
.
)
));

 

Trying to be able to specify more columns (:R050 etc...) without having to type them out...

 

kind of like

 

=AVERAGE(A1:G1)

0 Kudos
4 REPLIES 4
txnelson
Super User

Re: Control Chart Scripting Question

I am not aware of any such syntax. I suggest that you add your request to the JMP Wish List
Jim
0 Kudos
julian
Staff

Re: Control Chart Scripting Question

Hi @UberBock,

I'm also unaware of any jsl that will allow you to specify a column range in that way (and in general, I avoid numeric references to columns since order then affects the results of my scripts). That said, I feel your pain in specifying large numbers of columns. What I do is use the "Replace Selected Subexpression" operation in Formula Editor to create the list of columns, and then copy into my jsl. Just add a function (like max(), into your formula, select a set of columns, right click > replace the selected subexpression with columns. Here's what that looks like:Replace.gif

 

I hope this helps! 

@julian 

UberBock
Occasional Contributor

Re: Control Chart Scripting Question

THank you for the suggestion.  I can see how that would make it easier.  In my case it wouldnt work very well.  I am using the custom SQL to query data.  In the Post-Script Query tab I have various scripts to add things and other things.  So I would have to create a new table with the column names from the database to use what you suggest. RIght now I use excel/notepad to create a long list of comma delimited items to paste into the script.  I understand that my case is not common.

0 Kudos
julian
Staff

Re: Control Chart Scripting Question

Hi @UberBock,

I understand! Perhaps some jsl to make your list of columns and then evaluate the formula with that list could do the trick? Here's one (perhaps inelegant) way to do it:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Baltic.jmp" );

//set range for columns
colMin = 5;
colMax = 8;
colStrList = ""; 

//make list of columns
For( i = colMin, i < colMax, i++,
	colStrList ||= ":Name(\!"" || Column Name( i ) || "\!"),"
);

//create formula
Eval( Parse( Eval Insert( "\[

dt << New Column( "Test",
	"numeric",
	"continuous",
	Set Formula( Maximum( ^colStrList^ ) )
);

]\" ) ) );

@julian 

0 Kudos