Choose Language Hide Translation Bar
Highlighted
sbiedrzycki
Community Trekker

Getting control limits from column property

I found this topic earlier for pulling the spec limits from the column properties.

https://community.jmp.com/t5/Discussions/Get-column-Property-and-store-as-list/td-p/50885

 

I need to do similar however with the control limits as well.  For this however the same principle doesn't work.

CTRL = Column(colname) << Get Property( "Control Limits" );

LCL = CTRL["LCL"];

Returns: Name not found. in access or evaluation of 'Subscript' , CTRL[/*###*/"LCL"]

 

I can't figure out why the indexing is inconsistent here.  Overall it seems JSL is very inconsistent with accessing indexed object field information.  Is there something I'm missing?  I seem to spend half my time scripting just trying to figure out how to get access to the information embedded in objects.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Getting control limits from column property

It isn't that simple....wish it was.  Here is some code that I have used......there may be better code out there....I customized it for Individual Measurements limits....but it can be expanded

cLimits = dt:npn1 << get property( "control limits" );

For( i = 1, i <= N Items( cLimits ), i++,
	If( Trim( Word( 1, Char( cLimits[i] ), "(,)" ) ) == "Individual Measurements",
		IRLimits = Char( cLimits[1] );

		k=2;
		While( Word( k, IRLimits, "()" ) != "",
			If(
				Word( k, IRLimits, "()" ) == "Avg",
					Avg = Word( k + 1, IRLimits, "()" ),
				Word( k, IRLimits, "()" ) == "LCL",
					LCL = Word( k + 1, IRLimits, "()" ),
				Word( k, IRLimits, "()" ) == "UCL",
					UCL = Word( k + 1, IRLimits, "()" )
			);
			k++;
		);
	)
);
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Getting control limits from column property

Spec Limits are not nearly as complex as Control Limits are.  For Spec Limits, you basically have and LSL, Target and USL.  For Control Limits, you may have several different LCL, Avg and UCL groupings because of the different kinds of Control Limits.  See below output of the structure of Spec Limits and Control Limits for the same collumn.

dt:npn1 << get property("spec limits") = {LSL(104.41), USL(131.89), Target(118.15)};
dt:npn1 << get property("control limits") = {XBar(Avg(115), LCL(110), UCL(120), Subgroup Size(3)), R(Avg(10), LCL(5), UCL(15), Subgroup Size(3))};

Therefore, the retrieval and parsing of a Control Limit has to be completly different than for Spec Limits.

Jim
sbiedrzycki
Community Trekker

Re: Getting control limits from column property

I had noticed the different grouping and tried a dozen different ways to try to pull it from the child object with no luck.  The debugger shows it getting my Individual Measurements control limits but no form of indexing I tried seemed to be able to pull the individual limit values from the object.

 

I would expect to be able to do something like 

LCL =  (CTRL["Individual Measurements"])["LCL"];

or 

LCL = CTRL("Individual Measurements")["LCL"];

or something similar as in convention programming/scripting languages but nothing seemed to work.  How am I actually supposed to get access to that data?

0 Kudos
txnelson
Super User

Re: Getting control limits from column property

It isn't that simple....wish it was.  Here is some code that I have used......there may be better code out there....I customized it for Individual Measurements limits....but it can be expanded

cLimits = dt:npn1 << get property( "control limits" );

For( i = 1, i <= N Items( cLimits ), i++,
	If( Trim( Word( 1, Char( cLimits[i] ), "(,)" ) ) == "Individual Measurements",
		IRLimits = Char( cLimits[1] );

		k=2;
		While( Word( k, IRLimits, "()" ) != "",
			If(
				Word( k, IRLimits, "()" ) == "Avg",
					Avg = Word( k + 1, IRLimits, "()" ),
				Word( k, IRLimits, "()" ) == "LCL",
					LCL = Word( k + 1, IRLimits, "()" ),
				Word( k, IRLimits, "()" ) == "UCL",
					UCL = Word( k + 1, IRLimits, "()" )
			);
			k++;
		);
	)
);
Jim

View solution in original post

sbiedrzycki
Community Trekker

Re: Getting control limits from column property

Wow, that's ugly. I'm surprised there's no direct way to pull this data... I guess it's all the more reason to push more of my code outside of JMP where possible.  I appreciate the answer though especially given the depth to which was required to accomplish the task.

0 Kudos