cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-211488%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EHave%20syntax%20for%20specifying%20multiple%20consecutive%20columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211488%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EThis%20script%20works.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%26lt%3B%26lt%3B%20New%20Column(%20%22FrontPeak%22%2C%0A%20%22numeric%22%2C%0A%20%22continuous%22%2C%0A%20setFormula(%0A%20%20If(%20%3ADISPENSESPEED%20%3D%3D%201550%2C%0A%20%20%20Maximum(%0A%20%20%20%20%3AR029%2C%0A%20%20%20%20%3AR030%2C%0A%20%20%20%20%3AR031%2C%0A%20%20%20%20%3AR032%2C%0A%20%20%20%20%3AR033%2C%0A%20%20%20%20%3AR034%2C%0A%20%20%20%20%3AR035%2C%0A%20%20%20%20%3AR036%2C%0A%20%20%20%20%3AR037%2C%0A%20%20%20%20%3AR038%0A%20%20%20)%20*%201000%2C%0A%20%20%20.%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%20it%20would%20be%20nice%20to%20be%20able%20to%20be%20able%20to%20specify%20columns%20%3AR029%20to%20%3AR038%20or%20what%20ever%20number%20of%20columns.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELike%20the%20excel%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3DAVERAGE(A1%3AG1)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-211488%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EScripting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-211505%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Have%20syntax%20for%20specifying%20multiple%20consecutive%20columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211505%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F13651%22%20target%3D%22_blank%22%3E%40UberBock%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EThis%20is%20not%20to%20lessen%20the%20value%20of%20your%20request%2C%20however%2C%20when%20scripting%20there%20is%20a%20pretty%20easy%20solution%20since%20JMP%2013.%20This%20can%20also%20be%20specified%20using%20the%20formula%20editor%2C%20but%20it%20is%20a%20little%20more%20cumbersome.%20See%20the%20script%2C%20the%20formula%20and%20the%20result%20below.%20I%20don't%20store%20formulas%20in%20data%20table%20unless%20they%20are%20necessary.%26nbsp%3B%20The%20formula%20editor%20warns%20against%20using%20Current%20Data%20Table()%20in%20a%20formula%2C%20so%20the%20formula%20needs%20the%20table%20name.%20Using%20my%20preferred%20Set%20Each%20Value()%20instead%20of%20a%20formula%2C%20the%20table%20reference%20(dt%20or%20name%20in%20you%20script)%20can%20be%20used%20instead%20of%20the%20data%20table%20name.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20to%20Here(1)%3B%0A%0Adt%20%3D%20Open(%22%24Sample_Data%2FSemiconductor%20Capability.jmp%22)%3B%0A%0Atestcol%20%3D%20dt%20%26lt%3B%26lt%3B%20New%20Column(%22Maximum%207-11%22%2C%20numeric%2C%20continuous%2C%0A%20Formula(If(%3ASITE%3D%3D5%2C%20Maximum(Data%20Table(%22Semiconductor%20Capability%22)%5Brow()%2C4%3A%3A7%5D)%20))%0A)%3B%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20860px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20860px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20860px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17506i5F2D3B060477E385%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20938px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20938px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20938px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17507iA984AA385F2B14B8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-560874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Have%20syntax%20for%20specifying%20multiple%20consecutive%20columns%20-%20Status%20changed%20to%3A%20Archived%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-560874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EWe%20are%20archiving%20this%20request.%20If%20this%20is%20still%20important%20please%20comment%20with%20additional%20details%20and%20we%20will%20reopen.%20Thank%20you!%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
0 Kudos

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)

 

 

 

2 Comments
gzmorgan0
Super User (Alumni)

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]) ))
);

image.png

 

image.png

Ryan_Gilmore
Community Manager
Status changed to: Archived
We are archiving this request. If this is still important please comment with additional details and we will reopen. Thank you!