Choose Language Hide Translation Bar

## Have syntax for specifying multiple consecutive columns

This script works.

``````dt << New Column( "FrontPeak",
"numeric",
"continuous",
setFormula(
If( :DISPENSESPEED == 1550,
Maximum(
:R029,
:R030,
:R031,
:R032,
:R033,
:R034,
:R035,
:R036,
:R037,
:R038
) * 1000,
.
)
)
);``````

However it would be nice to be able to be able to specify columns :R029 to :R038 or what ever number of columns.

Like the excel

`=AVERAGE(A1:G1)`

### Defect ID:

1 Comment
Super User

Hi @UberBock,

This is not to lessen the value of your request, however, when scripting there is a pretty easy solution since JMP 13. This can also be specified using the formula editor, but it is a little more cumbersome. See the script, the formula and the result below. I don't store formulas in data table unless they are necessary.  The formula editor warns against using Current Data Table() in a formula, so the formula needs the table name. Using my preferred Set Each Value() instead of a formula, the table reference (dt or name in you script) can be used instead of the data table name.

``````Names Default to Here(1);

dt = Open("\$Sample_Data/Semiconductor Capability.jmp");

testcol = dt << New Column("Maximum 7-11", numeric, continuous,
Formula(If(:SITE==5, Maximum(Data Table("Semiconductor Capability")[row(),4::7]) ))
);

``````