제한 테이블에서 데이터 테이블로 제한 쓰기이 JMP Add-in은 Spec Limits와 별도의 데이터 테이블(Limits Table이라고 함)에 있는 23가지 유형의 Control Limits(예: XBar, S, 이동 범위 등) 중 하나를 선택하고 적절한 제한을 채웁니다. JMP 데이터 테이블의 열 속성.
위에서 언급한 것처럼 "제한 테이블"은 JMP 테이블일 뿐입니다.유효한 Limits Table이 되려면 업데이트할 열의 이름이 포함된 열과 측정 데이터가 있는 테이블의 열 속성으로 값을 이동할 각 특정 제한에 대한 열이 있어야 합니다. .다음은 Limits Table이 어떻게 생겼는지에 대한 예입니다.참고: 열 이름은 특정 이름을 가질 필요가 없습니다.보시다시피 사양 및 제어 한계의 다른 부분에 사용되는 열은 대화 상자 창에 매핑됩니다.

"제한 테이블"에는 7개의 열과 128개의 행이 있습니다.각 행에는 측정 데이터 표의 특정 열에 대한 제한이 포함되어 있습니다.이 예에서 "열 이름"이라는 열에는 업데이트할 측정 데이터 테이블의 열 이름이 포함되어 있습니다."Limits Table"의 모든 열은 수행하는 역할에 따라 Add-in에서 매핑됩니다.
아래 측정 데이터 테이블은 JMP 샘플 데이터 테이블의 반도체 성능 데이터 테이블입니다.이 예에서는 제공된 데이터 테이블의 일부인 사양 제한이 제거되었습니다.

추가 기능을 실행하려면 측정 데이터 테이블로 이동하고 클릭하여 현재 "활성" 데이터 테이블로 만듭니다. 그런 다음 Addin을 실행하면 나타나는 창이 업데이트에 사용할 "Limits Table"을 선택하도록 요청합니다.

사용할 테이블을 선택하면 "한계 테이블"의 열을 측정 데이터 테이블로 한도를 이동하는 역할에 매핑하는 선택 상자로 창이 확장됩니다.

매핑이 이루어지는 곳입니다.매핑할 첫 번째 항목은 업데이트할 열의 식별자로 사용할 "제한 테이블"의 열을 식별하는 것입니다.이 예에서 "열 이름" 열에는 이 정보가 포함되어 있으며 ID 열 선택 상자에 배치해야 합니다.

다음으로 제한 열을 제한 유형과 지정된 제한에 대한 상한, 목표 또는 하한인지 여부에 매핑합니다..사양 제한 및 제어 제한은 별도로 처리됩니다.매핑하려는 제한 유형과 일치하도록 Spec Limits 또는 Control Limits로 설정해야 하는 라디오 버튼이 있습니다.먼저 사양 제한을 설정합니다."제한" 테이블"에서 LSL, 목표 및 USL이라는 열에는 사양 제한이 포함되어 있습니다.이를 매핑하려면 각 항목을 선택하고 적절한 제한 선택 상자로 이동하기만 하면 됩니다.

XBar LCL, XBar 대상 및 XBar UCL 열에는 제어 한계가 포함되어 있습니다.특히 XBar 제어 한계가 포함되어 있습니다.Add=in에 매핑하려면 먼저 라디오 버튼을 "제한 제어"로 설정합니다.

매핑 환경이 약간 변경됩니다.디스플레이에 추가된 아래쪽 화살표 상자는 매핑하려는 제어 제한 유형을 설정할 수 있도록 합니다.

"제한 테이블"에 있는 제어 제한 유형은 XBar 제한이므로 우리가 선택한 제어 제한 유형입니다.그런 다음 각 열을 제한 롤에 매핑합니다.

"제한 테이블"에 더 많은 제어 제한 유형이 있는 경우 매핑하려는 제한 유형을 선택하는 단계를 반복한 다음 제한 유형을 나타내는 선택 상자에 적절한 열을 배치합니다.
매핑이 완료되면 "확인"을 클릭하여 추가 기능을 실행하십시오.완료되면 측정 데이터 테이블로 이동하여 제한 열 속성을 검토하여 성공했는지 확인할 수 있습니다.


품질 공학Re: 제한 테이블에서 데이터 테이블로 제한 쓰기@txnelson 도와 주셔서 정말로 고맙습니다!!
위의 스크립트가 잘 작동합니다!
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기JSL은 창이 표시되었다고 해서 스크립트 처리를 중지하지 않습니다.따라서 창이 표시되는 동안 "Biv6" 그래프 빌더가 실행되고 있는 것입니다.사양 제한을 추가하는 코드 끝에 "Biv6" 코드를 실행하도록 입력 대화 상자 코드를 변경해야 합니다.
그래프 빌더 코드를 Expr() 함수로 캡슐화하도록 변경하면 Expr()이 실행될 때까지 실행되지 않습니다.
myGraphBuilder = Expr(
biv6 = Graph Builder(
Variables( X( :PPO_26_H ) ),
Show Control Panel( 0 ),
Elements( Histogram( X, Legend( 4 ) ), Box Plot( X, Legend( 6 ) ) ),
SendToReport(
Dispatch( {}, "PPO_26_H", ScaleBox, {Label Row( Set Font Size( 16 ) )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Font Size( 24 )} )
)
);
biv6 << save picture( "c:\temp\biv6.png" );
);
이제 대화 상자에서 Graph Builder를 실행할 시기를 결정하기만 하면 됩니다.내 제안은 "runit" Expr() 실행 직후 버튼 상자 "OK" 스크립트에 배치하는 것입니다.
Button Box( "OK",
WriteLimitColNames( LimitNum );
lowconcat = highconcat = "";
For( i = 1, i <= N Items( LowList ), i++,
lowconcat = lowconcat || LowList[i];
highconcat = highconcat || HighList[i];
);
LimitsChoosen = Length( lowconcat || highconcat ) > 0;
// Check to see if the required data has been input
If(
N Items( colListY << GetItems ) == 0, Dialog( "No ID Column Specified", Button( "OK" ) ), // Else
LimitsChoosen == 0, Dialog( "No Limit Columns Specified", Button( "OK" ) ), // Else
RecallList = {lowlist = {}, avglist = {}, highlist = {}};
RecallList["lowlist"] = lowlist;
RecallList["avglist"] = avglist;
RecallList["highlist"] = highlist;
// Place the selected values from the screen into the recall list
Insert Into( RecallList, Parse( "IDColumn = \!"" || Char( (colListY << get items)[1] ) || "\!"" ) );
If( IgnoreCB << get == 1,
IgnoreMissing = "Yes",
IgnoreMissing = "No"
);
ShowLims = ShowCB << get;
ShowRpt = ReportCB << get;
Insert Into( RecallList, Parse( "IgnoreMissing = \!"" || IgnoreMissing || "\!"" ) );
Insert Into( RecallList, Parse( "ShowLims = " || Char( showlims ) ) );
Insert Into( RecallList, Parse( "ShowRpt = " || Char( showRpt ) ) );
// Save recall string to Recall namespace
Recall:WriteLimits = RecallList;
nw << CloseWindow;
dtReport = New Table( "Report",
Private,
New Column( "Column", Character, "Nominal" ),
New Column( "Limit Type", Character, "Nominal" ),
New Column( "Level",
Character,
"Nominal",
Set Property( "Value Ordering", {"Lower", "Average", "Upper"} )
),
New Column( "Value", Numeric, "Continuous", Format( "Best", 10 ) ),
New Column( "Limit",
Character,
"Nominal",
Set Property( "Value Ordering", {"Spec Limit", "Control Limit"} )
),
New Column( "OldNew", Character, "Nominal", Set Property( "Value Ordering", {"Previous", "New"} ) )
);
dtReport:Column << set property( "Row Order Levels", 1 );
// Create a working copy of the limits table
dtLimits << Select Rows( NotFoundListRowNumbers );
dtLimits << invert row selection;
dtLimitsTemp = dtLimits << subset(invisible, selected rows(1), selected columns(0));
dtLimits << clear select;
dtOriginalLimits = dtLimits;
dtLimits = dtLimitsTemp;
wait(0);
// Run the actual code that updates the limits
runit;
myGraphBuilder;
);
),
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기그래프 작성기 및 이미지 저장!
Graph buider가 사양 후 이미지에 저장하고 싶지만 t 아래 스크립트는 사양이 적용되기 전에 이미지를 생성합니다.
Open("C:\Users\A07\Desktop\data\Working data\Jump\spec_limit.jmp");
dt = open();
Names Default To Here( 1 );
Clear Symbols();
/*****************************************************************************/
/* */
/* This is the inital piece of code to be run in the script */
/* It initializes the environment and opens the initial user inptut dialog */
/* */
/*****************************************************************************/
Main = Expr(
dt = Current Data Table();
LastColListY = "";
// The recall values are saved into a namespace called "Recall"
// and if it currently doesn't exist, set it up
If( Namespace Exists( "Recall" ) == 0,
recall = New Namespace(
"Recall"
)
);
// Get a list of all of the numeric columns in the data table
AllNumericColumns = dt << get column names( numeric, string );
AllNumericColumnsCompressed = AllNumericColumns;
// Uppercase and compress the column names
For( i = 1, i <= N Items( AllNumericColumns ), i++,
AllNumericColumnsCompressed[i] = Uppercase( AllNumericColumnsCompressed[i] );
While( Pat Match( AllNumericColumnsCompressed[i], " ", "" ) > 0, Pat Match( AllNumericColumnsCompressed[i], " ", "" ) );
);
// This iist is the list of the names used within JMP Contol Limits and is used by the script
// to set the type of contol limit being updated
ControlLimitList = {"XBar", "R", "S", "Individual Measurement", "Moving Range", "Median Moving Range", "P", "NP", "C", "U", "UWMA", "EWMA",
"CUSUM", "Levey Jennings", "Individual on Group Means", "Individual on Group Std Devs", "Moving Range on Group Means",
"Moving Range on Group Stds", "Median Moving Range on Group Means", "Median Moving Range on Group Std Devs", "Run Chart", "G", "T"};
// Variale used to set the length of the column selection list
nc = N Col( dt );
lbWidth = 160;
// Create a list of all of the open tables
list_tables = {};
For( i = 1, i <= N Table(), i++,
Insert Into( list_tables, Data Table( i ) << get name )
);
// Display the Limits Table Selection window
nw = New Window( "Populate Limits",
V List Box(
Spacer Box( size( 1, 5 ) ),
H List Box( IconBB = Button Box( "" ), IconTB = Text Box( "Populate Limits Column Property from a separate table" ) ),
Spacer Box( size( 1, 20 ) ),
TheHlB = H List Box(
V List Box(
Text Box( "Select Limits Table" ),
Spacer Box( size( 1, 2 ) ),
Panel Box( "Set Limits in " || Char( dt << get name ) || " with",
TableLB = List Box( list_tables, n lines( 6 ), width( 220 ) ),
)
)
),
Spacer Box( size( 1, 10 ) ),
H List Box(
Spacer Box( size( 10, 1 ) ),
createtableBB = Button Box( "Create Limits Table from Current Active Data Table", createlimitstable )
),
Spacer Box( size( 1, 10 ) )
),
// When the user selection for the limits data table changes, reset the column dialog boxes
TableLB << on change(
// Delete the button box
Try( createtableBb << delete );
// Blank out the low,avg and high lists
resetlists;
// Delete the current column dialog boxes
Try( clusterdlg << delete );
// If the user has selected a new limits table, reset the window
If( Try( (tablelb << get selected)[1], "" ) != "",
dtlimits = Data Table( (tablelb << get selected)[1] );
Current Data Table( dtlimits );
// Reinput the code for the column dialog boxes....this is
// required, because the col list boxes do not lose the data
// table references without totally deleting the col list box
// and bringing in new instances
clusterexpr;
// Add the col dialog boxes to the current display
theHLB << append( clusterdlg );
// Reset required lists
AllLimitColList = AllLimitColListCompressed = {};
Try( AllLimitColList = Column( dtlimits, Column Names ) << get values );
AllLimitColListCompressed = AllLimitColList;
// Uppercase and remove blanks from the column list
For( i = 1, i <= N Items( AllLimitColList ), i++,
AllLimitColListCompressed[i] = Uppercase( AllLimitColListCompressed[i] );
While( Pat Match( AllLimitColListCompressed[i], " ", "" ) > 0, Pat Match( AllLimitColListCompressed[i], " ", "" ) );
);
);
),
// Set the icon
iconbb << set icon( "Update" )
);
);
/*****************************************************************************/
/* */
/* Create a Limits Table populating limits from the current data table */
/* */
/*****************************************************************************/
CreateLimitsTable = Expr(
HasBeenSeen = Repeat( 0, 24 );
dtnew = New Table( "Limits Table", invisible, New Column( "Column Names", character, values( AllNumericColumns ) ) );
// Pass through all of the specified parameters and extract any limits found in the
// active data table and move them to the new limits data table
For( allvars = 1, allvars <= N Items( AllNumericColumns ), allvars++,
col = Parse( "dt:" || AllNumericColumns[allvars] );
// Gather in the already set Control and Spec Limits
controls = col << get property( "Control Limits" );
specs = col << get property( "Spec Limits" );
// Process Spec Limits
If( !(Char( specs ) == "Scriptable[]" | Is Empty( specs ) == 1),
If( HasBeenSeen[24] == 0,
dtnew << New Column( "LSL" );
dtnew << New Column( "Target" );
dtnew << New Column( "USL" );
HasBeenSeen[24] = 1;
);
For( i = 1, i <= N Items( specs ), i++,
If( Is Missing( Try( Specs["LSL"], . ) ) == 0,
dtnew:LSL[AllVars] = Specs["LSL"]
);
If( Is Missing( Try( Specs["Target"], . ) ) == 0,
dtnew:Target[AllVars] = Specs["Target"]
);
If( Is Missing( Try( Specs["LSL"], . ) ) == 0,
dtnew:USL[AllVars] = Specs["USL"]
);
);
);
// All of the Control limits have the same structure. This code extracts all of the different
// types of control limits and moves them to the limits table
If( !(Char( controls ) == "Scriptable[]" | Is Empty( controls ) == 1),
For( i = 1, i <= N Items( controls ), i++,
If( Contains( ControlLimitList, Trim( Word( 1, Char( controls[i] ), "(,)" ) ) ) > 0,
Control Limit Type = Trim( Word( 1, Char( controls[i] ), "(,)" ) );
LimitListNumber = Contains( ControlLimitList, Trim( Word( 1, Char( controls[i] ), "(,)" ) ) );
If( HasBeenSeen[LimitListNumber] == 0,
dtnew << New Column( ControlLimitList[LimitListNumber] || "LCL" );
dtnew << New Column( ControlLimitList[LimitListNumber] || "AVG" );
dtnew << New Column( ControlLimitList[LimitListNumber] || "UCL" );
HasBeenSeen[LimitListNumber] = 1;
);
For( ctype = 2, ctype <= 6, ctype = ctype + 2,
If( Trim( Word( ctype, Char( controls[i] ), "(,)" ) ) == "Avg",
Column( dtnew, ControlLimitList[LimitListNumber] || "AVG" )[AllVars] = Num(
Word( ctype + 1, Char( controls[i] ), "(,)" )
)
);
If( Trim( Word( ctype, Char( controls[i] ), "(,)" ) ) == "LCL",
Column( dtnew, ControlLimitList[LimitListNumber] || "LCL" )[AllVars] = Num(
Word( ctype + 1, Char( controls[i] ), "(,)" )
)
);
If( Trim( Word( ctype, Char( controls[i] ), "(,)" ) ) == "UCL",
Column( dtnew, ControlLimitList[LimitListNumber] || "UCL" )[AllVars] = Num(
Word( ctype + 1, Char( controls[i] ), "(,)" )
)
);
);
)
);
);
);
If( N Cols( dtnew ) == 1,
dtnew << New Column( "LSL" );
dtnew << New Column( "Target" );
dtnew << New Column( "USL" );
dtnew << New Column( "XBarLCL" );
dtnew << New Column( "XBarAVG" );
dtnew << New Column( "XBarUCL" );
);
Insert Into( List_Tables, "Limits Table" );
x = List_Tables;
TableLB << RemoveAll;
TableLB << append( list_tables );
dtnew << zoom window;
);
/*****************************************************************************/
/* */
/* Blank out all selections and reset to the current limit */
/* */
/*****************************************************************************/
resetLists = Expr(
lowList = avgList = highList = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
If( Try( LimitTypeRB << get, 1 ) == 1,
limitNum = 24,
LimitNum = cb << get
);
);
// Initialize the lists
ResetLists;
/*****************************************************************************/
/* */
/* Set the Control Limits for all specified control limits for a single */
/* row from the limits data table */
/* */
/*****************************************************************************/
SetControlLimits = Function( {c, CList, IgnoreMissing, i},
{c, CList, IgnoreMissing},
// Big List pulls in any existing limit control values. This allows for the addition of
// replacement of limit values without erasing any limits that currently exist.
c = AllNumericColumns[Contains( AllnumericColumnsCompressed, AllLimitColListCompressed[i] )];
biglist = Column( dt, c ) << getproperty( "control limits" );
// Roll across all of the types of contol limits found
For( cl = 1, cl <= N Items( CList ), cl++,
little = {__type__( Avg( avexpr ), UCL( ULexpr ), LCL( LLexpr ) )};
Substitute Into( little, Expr( __type__ ), Parse( controllimitnamesList[CList[cl]] ) );
// Get the new limits to be processed from the limits table
// If no column has been specified for one of the limits, a
// missing value is set
lcl = Try( Column( dtlimits, lowlist[CList[cl]] )[i], . );
tar = Try( Column( dtlimits, avglist[CList[cl]] )[i], . );
ucl = Try( Column( dtlimits, highlist[CList[cl]] )[i], . );
// If Control Limits were found interrogate them
If( Is Empty( biglist ) == 0,
For( _i_ = N Items( big list ), _i_ >= 1, _i_--,
If( Uppercase( Word( 1, biglist[_i_], "(" ) ) == Uppercase( controllimitnamesList[CList[cl]] ),
onelist = Char( biglist[_i_] );
xlcl = .;
xtarget = .;
xucl = .;
For( limitcnt = 2, limitcnt <= 7, limitcnt = limitcnt + 2,
alimit = Word( limitcnt, onelist, "(,)" );
If(
Contains( alimit, "LCL" ) > 0, xlcl = Num( Word( limitcnt + 1, onelist, "(,)" ) ),
Contains( alimit, "Avg" ) > 0, xtarget = Num( Word( limitcnt + 1, onelist, "(,)" ) ),
Contains( alimit, "UCL" ) > 0, xucl = Num( Word( limitcnt + 1, onelist, "(,)" ) )
);
);
Remove From( biglist, _i_ );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = xlcl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = xtarget;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = xucl;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
);
// If the limits do not currently exist, but other control limits are there,
// insert the new control limits into the large control limit list
If( Is Missing( lcl ) + Is Missing( tar ) + Is Missing( ucl ) > 0,
// If Missing values from the limits table are to signal not to
// change the current limit, then process them accoringly
If( IgnoreMissing == "No",
If( LowList[CList[cl]] != "",
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) ),
Substitute Into( little, Expr( LLexpr ), Eval( xlcl ) );
lcl = xlcl;
);
If( AvgList[CList[cl]] != "",
Substitute Into( little, Expr( avexpr ), Eval( tar ) ),
Substitute Into( little, Expr( avexpr ), Eval( xtarget ) );
tar = xtarget;
);
If( HighList[CList[cl]] != "",
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) ),
Substitute Into( little, Expr( ULexpr ), Eval( xucl ) );
ucl = xucl;
);
,
If( Is Missing( lcl ) == 1 | LowList[CList[cl]] == "",
Substitute Into( little, Expr( LLexpr ), Eval( xlcl ) );
lcl = xcl;
,
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) )
);
If( Is Missing( ucl ) == 1 | HighList[CList[cl]] == "",
Substitute Into( little, Expr( ULexpr ), Eval( xucl ) );
ucl = xucl;
,
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) )
);
If( Is Missing( tar ) == 1 | AvgList[CList[cl]] == "",
Substitute Into( little, Expr( avexpr ), Eval( xtarget ) );
tar = xtarget;
,
Substitute Into( little, Expr( avexpr ), Eval( tar ) )
);
)
,
// Just add the new limits if not concerned about preserving data
// and replacing limits if missing values have been specified
If( Is Missing( lcl ) + Is Missing( tar ) + Is Missing( ucl ) < 3,
If( LowList[CList[cl]] != "",
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) ),
Substitute Into( little,
Expr( LLexpr ),
Eval( xlcl );
lcl = xlcl;
)
);
If( AvgList[CList[cl]] != "",
Substitute Into( little, Expr( avexpr ), Eval( tar ) ),
Substitute Into( little, Expr( avexpr ), Eval( xtarget ) );
tar = xtarget;
);
If( HighList[CList[cl]] != "",
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) ),
Substitute Into( little, Expr( ULexpr ), Eval( xucl ) );
ucl = xucl;
);
)
);
// If the big list doesn't exist, create it
If( Is Empty( biglist ) == 1,
biglist = {}
);
// Add the current limit type to the overall list of control limits
Insert Into( biglist, little );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = lcl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = tar;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = ucl;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
)
,
// No control limits currently exist for the target column, so create the large
// control limit list by setting it equal to the new input limits
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = .;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = .;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = .;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
If( Is Missing( lcl ) + Is Missing( tar ) + Is Missing( ucl ) < 3,
If( LowList[CList[cl]] != "",
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) ),
Substitute Into( little, Expr( LLexpr ), Eval( . ) );
lcl = .;
);
If( AvgList[CList[cl]] != "",
Substitute Into( little, Expr( avexpr ), Eval( tar ) ),
Substitute Into( little, Expr( avexpr ), Eval( . ) );
tar = .;
);
If( HighList[CList[cl]] != "",
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) ),
Substitute Into( little, Expr( ULexpr ), Eval( . ) );
ucl = .;
);
);
// If the big list doesn't exist, create it
If( Is Empty( biglist ) == 1,
biglist = {}
);
// Add the current limit type to the overall list of control limits
Insert Into( biglist, little );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = lcl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = tar;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = ucl;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
)
;
);
If( Char( biglist ) != "Scriptable[]" & Is Empty( biglist ) == 0 & biglist != {},
Column( dt, c ) << setproperty( "control limits", Eval( biglist ) )
);
);
/*****************************************************************************/
/* */
/* Set the Spec Limits for all specified control limits for a single */
/* row from the limits data table */
/* */
/*****************************************************************************/
SetSpecLimits = Function( {c, lsl, usl, avg, IgnoreMissing, showlims},
{c, lsl, usl, avg, IgnoreMissing, showlims},
// Get the current spec limits
Try( speclist = Column( dt, c ) << get property( "spec limits" ), {} );
Try( xlsl = speclist["LSL"], xlsl = . );
Try( xusl = speclist["USL"], xusl = . );
Try( xavg = speclist["Target"], xavg = . );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = xlsl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = xavg;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = xusl;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
// Process the limits
If( Is Missing( lsl ) + Is Missing( avg ) + Is Missing( usl ) < 3,
// If misssing value input is to be Ignored, that means that
// old values of the limits are to be moved forward if the new
// input values are missing values
If( IgnoreMissing == "Yes",
If( (Is Missing( xusl ) == 1 & Is Missing( usl ) == 0) | HighList[24] != "",
xusl = usl
);
If( (Is Missing( xlsl ) == 1 & Is Missing( lsl ) == 0) | LowList[24] != "",
xlsl = lsl
);
If( (Is Missing( xavg ) == 1 & Is Missing( avg ) == 0) | AvgList[24] != "",
xavg = avg
);
cmd = Expr(
Column( dt, c ) << SetProperty(
"Spec LImits",
{LSL( Expr( xlsl ) ), USL( Expr( xusl ) ), Target( Expr( xavg ) ), Show Limits( Expr( showlims ) )}
)
);
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = xlsl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = xavg;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = xusl;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
, // Else
If( LowList[24] == "",
lsl = xlsl
);
If( AvgList[24] == "",
avg = xavg
);
If( HighList[24] == "",
usl = xusl
);
cmd = Expr(
Column( dt, c ) << SetProperty(
"Spec LImits",
{LSL( Expr( lsl ) ), USL( Expr( usl ) ), Target( Expr( avg ) ), Show Limits( Expr( showlims ) )}
)
);
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = lsl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = avg;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = usl;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
);
Eval( Eval Expr( cmd ) );
);
);
/*****************************************************************************/
/* */
/* Run through each of the columns in the limits table and call the functions*/
/* that update the limits, based upon what limits have been specified in the */
/* dialog input screen */
/* */
/*****************************************************************************/
runit = Expr(
ControlLimitNamesList = {"XBar", "R", "S", "Individual Measurement", "Moving Range", "Median Moving Range", "P", "NP", "C", "U", "UWMA", "EWMA",
"CUMSUM", "Levey Jennings", "Individual on Group Means", "Individual on Group Std Devs", "Moving Range on Group Means",
"Moving Range on Group Std Devs", "Median Moving Range on Group Means", "Median Moving Range on Group Std Devs", "Run Chart", "G", "T"};
// Create a list of which control limits have been specified
CList = {};
For( i = 1, i <= 23, i++,
If( LowList[i] || avgList[i] || highList[i] != "",
Insert Into( CList, i )
)
);
// If spec limits have been specified, setup a similar flag to the control limits
// to use for spec limit processing
SLList = {};
If( LowList[24] || avgList[24] || highList[24] != "",
Insert Into( SLList, 24 )
);
// Get Excluded Rows in the Limits Table so they can be bypassed in processing
Excluded Rows = As List( dtLimits << get excluded rows );
// Roll across the rows in the limits table and process the new limits
For( ii = 1, ii <= N Items( AllLimitColList ), ii++,
Process = "Yes";
If( N Items( Excluded Rows ) > 0,
If( Loc( Excluded Rows, ii ) > 0,
Process = "No",
Process = "Yes"
)
);
If( Process == "Yes",
targetName = AllNumericColumns[Contains( AllnumericColumnsCompressed, AllLimitColListCompressed[ii] )];
//ii=30
// If there are spec limits to be processed, call the setspeclimits function
If( N Items( SLList ) > 0,
return = setspeclimits(
Targetname,
Try( Column( dtlimits, lowlist[24] )[ii], . ),
Try( Column( dtlimits, highlist[24] )[ii], . ),
Try( Column( dtlimits, avglist[24] )[ii], . ),
IgnoreMissing,
showLims
)
);
// If Control limit changes have been specified, call the SetControlLimits function
If( N Items( CList ) > 0,
return = SetControlLimits( TargetName, CList, IgnoreMissing, ii )
);
);
);
ShowReport;
close(dtLimits, nosave );
dtLimits = dtOriginalLimits;
current data table(dt);
);
/*****************************************************************************/
/* */
/* This is the display for the column selections where the user matches the */
/* the limit columns from the limit data table with the columns in the */
/* data table */
/* */
/*****************************************************************************/
clusterexpr = Expr(
all Columns List = dtlimits << get column names;
Current Data Table( dtlimits );
clusterDlg = V List Box(
Border Box( Left( 3 ), top( 2 ),
V List Box(
Text Box( "Select Columns to Read the Limits From" ),
H List Box(
V List Box(
// Generate the master display box for the columns in the data table
Panel Box( "Select Columns",
cldvlb = H List Box(
Popup Box(
{"Clear", filterval = "" ; thefilter << set text( "" ) ; clearit ; ,
"Numeric", filterval = "" ; thefilter << set text( "" ) ; clearit ; For( II = 1,
II <= N Items( All Columns List ), II++,
If( Column( All Columns List[II] ) << get data type != "Numeric",
colListData << set selected( II )
)
) ; colListData << remove selected ; ,
"Character", filterval = "" ; thefilter << set text( "" ) ; clearit ; For( II = 1,
II <= N Items( All Columns List ), II++,
If( Column( All Columns List[II] ) << get data type != "Character",
colListData << set selected( II )
)
) ; colListData << remove selected ; ,
"Name Contains", filterval = "" ; filtervlb << prepend(
V List Box(
thefilter = Text Edit Box( "",
<<SET width=""> 0;
// Check to see if the required data has been input
If(
N Items( colListY << GetItems ) == 0, Dialog( "No ID Column Specified", Button( "OK" ) ), // Else
LimitsChoosen == 0, Dialog( "No Limit Columns Specified", Button( "OK" ) ), // Else
RecallList = {lowlist = {}, avglist = {}, highlist = {}};
RecallList["lowlist"] = lowlist;
RecallList["avglist"] = avglist;
RecallList["highlist"] = highlist;
// Place the selected values from the screen into the recall list
Insert Into( RecallList, Parse( "IDColumn = \!"" || Char( (colListY << get items)[1] ) || "\!"" ) );
If( IgnoreCB << get == 1,
IgnoreMissing = "Yes",
IgnoreMissing = "No"
);
ShowLims = ShowCB << get;
ShowRpt = ReportCB << get;
Insert Into( RecallList, Parse( "IgnoreMissing = \!"" || IgnoreMissing || "\!"" ) );
Insert Into( RecallList, Parse( "ShowLims = " || Char( showlims ) ) );
Insert Into( RecallList, Parse( "ShowRpt = " || Char( showRpt ) ) );
// Save recall string to Recall namespace
Recall:WriteLimits = RecallList;
nw << CloseWindow;
dtReport = New Table( "Report",
Private,
New Column( "Column", Character, "Nominal" ),
New Column( "Limit Type", Character, "Nominal" ),
New Column( "Level",
Character,
"Nominal",
Set Property( "Value Ordering", {"Lower", "Average", "Upper"} )
),
New Column( "Value", Numeric, "Continuous", Format( "Best", 10 ) ),
New Column( "Limit",
Character,
"Nominal",
Set Property( "Value Ordering", {"Spec Limit", "Control Limit"} )
),
New Column( "OldNew", Character, "Nominal", Set Property( "Value Ordering", {"Previous", "New"} ) )
);
dtReport:Column << set property( "Row Order Levels", 1 );
// Create a working copy of the limits table
dtLimits << Select Rows( NotFoundListRowNumbers );
dtLimits << invert row selection;
dtLimitsTemp = dtLimits << subset(invisible, selected rows(1), selected columns(0));
dtLimits << clear select;
dtOriginalLimits = dtLimits;
dtLimits = dtLimitsTemp;
wait(0);
// Run the actual code that updates the limits
runit;
);
),
Button Box( "Cancel",
clusterDlg << CloseWindow;
Names Default To Here( 1 );
),
Text Box( " " ),
Button Box( "Remove",
colListY << RemoveSelected;
collower << remove selected;
colaverage << remove selected;
colupper << remove selected;
),
Button Box( "Recall",
If( Is List( Recall:WriteLimits ) == 1,
Eval List( Recall:WriteLimits );
If( Try( (colListY << get items)[1], "" ) != IDcolumn,
colListY << RemoveAll;
colListY << append( IDcolumn );
);
If( IgnoreMissing == "Yes",
IgnoreCB << set( 1 ),
IgnoreCB << set( 0 )
);
ShowCB << set( ShowLims );
ReportCB << set( ShowRpt );
readLimitColNames( LimitNum );
)
),
Button Box( "Help", notImplemented )
)
)
),
)
)
),
// Set the default values for the check box options
IgnoreCB << set( 1 );
IgnoreMissing = "Yes";
ShowCB << set( 1 );
ShowLims = 1;
ReportCB << set( 1 );
ShowRpt = 1;
);
// Write the names to the Limit Lists ffrom the display window
WriteLimitColNames = Function( {lNum},
LowList[LNum] = Try( (colLower << get items)[1], "" );
AvgList[LNum] = Try( (colAverage << get items)[1], "" );
HighList[LNum] = Try( (colUpper << get items)[1], "" );
);
// Read the limit values from the Limit Lists and populate
// the display window with the values
ReadLimitColNames = Function( {lNum},
{lNum},
tmplist = lowlist;
ColLower << remove all;
lowlist = tmplist;
tmplist = {};
Insert Into( tmplist, lowlist[lnum] );
collower << append( tmplist );
tmplist = avglist;
ColAverage << remove all;
avglist = tmplist;
tmplist = {};
Insert Into( tmplist, avglist[lnum] );
colAverage << append( tmplist );
tmplist = Highlist;
ColUpper << remove all;
Highlist = tmplist;
tmplist = {};
Insert Into( tmplist, Highlist[lnum] );
ColUpper << append( tmplist );
);
// When the value for the column that contains the names of the data
// table columns that will have their limits changed, process the list,
// comparing it to the data table to check for columns not found
ColListY << On Change(
If( Try( (ColListY << get items)[1], "" ) != LastColListY,
If( Try( N Items( colListY << get items ), 0 ) > 0,
AllLimitColList = AllLimitColListCompressed = NotProcessedColumnsList = NotProcessedColumnsListCompressed = {};
LastColListY = (ColListY << get items)[1];
If( Try( (colListY << get items)[1], "" ) != "",
AllLimitColList = Column( dtlimits, (colListY << get items)[1] ) << get values;
AllLimitColListCompressed = AllLimitColList;
NotFoundList = {};
NotFoundListRowNumbers = {};
// Uppercase and compress the column names
For( i = N Items( AllLimitColList ), i > 0, i--,
AllLimitColListCompressed[i] = Uppercase( AllLimitColListCompressed[i] );
While( Pat Match( AllLimitColListCompressed[i], " ", "" ) > 0, Pat Match( AllLimitColListCompressed[i], " ", "" ) );
If( Contains( AllNumericColumnsCompressed, AllLimitColListCompressed[i] ) == 0,
Insert Into( NotFoundList, AllLimitColList[i] );
Insert Into( NotFoundListRowNumbers, i );
AllLimitColListCompressed = Remove( AllLimitColListCompressed, i, 1 );
AllLimitColList = Remove( AllLimitColList, i, 1 );
);
);
// Find all of the columns that are not going to be processed
NotProcessedColumnsListCompressed = NotProcessedColumnsList = dt << get column Names( string );
For( i = N Items( NotProcessedColumnsList ), i > 0, i--,
NotProcessedColumnsListCompressed[i] = Uppercase( NotProcessedColumnsListCompressed[i] );
While( Pat Match( NotProcessedColumnsListCompressed[i], " ", "" ) > 0,
Pat Match( NotProcessedColumnsListCompressed[i], " ", "" )
);
If( Contains( AllLimitColListCompressed, NotProcessedColumnsListCompressed[i] ) > 0,
//Insert Into( NotFoundList, AllLimitColList[i] );
NotProcessedColumnsListCompressed = Remove( NotProcessedColumnsListCompressed, i, 1 );
NotProcessedColumnsList = Remove( NotProcessedColumnsList, i, 1 );
);
);
// If there are columns that do not exist in the data table, notify the user
If( N Items( NotFoundList ) > 0,
winLocation = nw << get window position;
err = New Window( "Columns Not Found",
Border Box( top( 10 ), Left( 10 ), Right( 10 ), bottom( 10 ), sides( 15 ),
V List Box(
Spacer Box( size( 1, 10 ) ),
Text Box( "The following column(s) names(s) were referenced in the" ),
Text Box( "Limit Table, but no numeric column of that/those name(s)" ),
Text Box( "were found in the data table." ),
Spacer Box( size( 1, 10 ) ),
H List Box( Spacer Box( size( 60, 1 ) ), List Box( NotFoundList ) ),
Spacer Box( size( 1, 10 ) ),
Text Box( "No limits will be set for the above referenced columns" ),
Spacer Box( size( 1, 10 ) ),
H List Box(
continueBB = Button Box( "Continue Anyway", err << close window ),
stopBB = Button Box( "Stop Script",
err << close window;
nw << close window;
Throw();
)
)
)
)
);
err << move window( winLocation[1] + 100, winLocation[2] + 100 ) << zoom window;
);
);
)
)
);
);
/*****************************************************************************/
/* */
/* An Expr to run for any function that has not been implemented. It */
// displays a dialog window telling the user that the function has not been */
/* implemented yet */
/* */
/*****************************************************************************/
notImplemented = Expr(
Dialog( "Feature Not Implemented Yet", Button( "OK" ) )
);
/*****************************************************************************/
/* */
/* Code used in the column selection filter to reset the selection box */
/* */
/*****************************************************************************/
clearit = Expr(
For( II = 1, II <= N Items( colListData << get items ), II++,
colListData << set selected( II )
);
colListData << remove selected;
colListData << append( all columns list );
);
// Call the main expr as the inital piece of script to be run
main;
biv6 = Graph Builder(
Variables( X( :PPO_26_H ) ),
Show Control Panel( 0 ),
Elements( Histogram( X, Legend( 4 ) ), Box Plot( X, Legend( 6 ) ) ),
SendToReport(
Dispatch( {}, "PPO_26_H", ScaleBox, {Label Row( Set Font Size( 16 ) )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Font Size( 24 )} )
)
);
biv6 << save picture("c:\temp\biv6.png");</SET>
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기어떤 그래프를 말씀하시는 건가요?요약 보고서?
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기감사합니다. 이 추가 기능은 저에게 매우 유용합니다.
질문이 하나 있습니다.
추가 기능을 먼저 실행한 후 그래프를 어떻게 만들 수 있습니까?
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기훌륭한 추가 기능 및 스크립팅 감사합니다!
일부 분석을 자동화하기 위해 노력해 왔으며 이것은 완벽하게 작동합니다. 공정 능력 분석이 필요하지 않으며 100개 이상의 변수로 매우 느립니다. 어떤 이유로 테이블에서 가져오지 않고 중단되는 사양 제한을 관리합니다.
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기사양 제한 참조선의 기본 색상을 변경하는 기본 설정을 알지 못합니다.과거에 내가 한 일은 내가 원하는 색상으로 나만의 참조선을 만들고 제한선을 생성하기 위해 JMP 기본값을 사용하지 않는 것이었습니다.
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기안녕 @txnelson ,
어쨌든 USL 및 LSL 라인 색상을 빨간색(기본 파란색에서)으로 변경할 수 있습니까?
감사합니다,
앤 앤
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기JMP에 한도 테이블에서 데이터 테이블에 대한 한도 쓰기를 대신하는 한도 관리 기능이 추가되었으므로 Addin을 개선하지는 않겠습니다.그러나 아래는 한도 데이터 테이블에서 읽고 단위를 다른 테이블의 열에 추가하는 시작 및 스크립트를 제공하는 간단한 스크립트입니다.
Names Default To Here( 1 );
Clear Symbols();
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dtLimits = New Table( "Limits",
New Column( "Column Name", Character, values( {"height", "weight"} ) ),
New Column( "Units", Character, values( {"Inches", "Lbs"} ) )
);
colNamesList = {"height", "weight"};
For( i = 1, i <= N Items( colNamesList ), i++,
dtLimits << select where( :Column Name == colNamesList[i] );
If( N Rows( dtLimits << get selected rows ) > 0,
Eval(
Substitute(
Expr(
Column( dt, colNamesList[i] ) << set property( "Units", __units__ )
),
Expr( __units__ ), dtLimits:Units[i]
)
)
);
);Re: 제한 테이블에서 데이터 테이블로 제한 쓰기@txnelson 이것은 환상적인 애드온입니다. 다른 사양 시트에서 열에 "단위"를 추가할 수 있습니까? 향상된 JSL 스크립트가 있습니까?
감사해요,
벤캇
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기완벽한! 이것은 올바르게 작동합니다. 계속해서 이 버전의 코드를 추가용으로 만드십시오...
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기다음은 문제를 해결할 것이라고 믿는 버전입니다.사용해 보고 문제가 해결되면 다시 연락주세요.그런 다음 파일 교환에 새 추가 기능을 게시하겠습니다.
Names Default To Here( 1 );
Clear Symbols();
/*****************************************************************************/
/* */
/* This is the inital piece of code to be run in the script */
/* It initializes the environment and opens the initial user inptut dialog */
/* */
/*****************************************************************************/
Main = Expr(
dt = Current Data Table();
LastColListY = "";
// The recall values are saved into a namespace called "Recall"
// and if it currently doesn't exist, set it up
If( Namespace Exists( "Recall" ) == 0,
recall = New Namespace(
"Recall"
)
);
// Get a list of all of the numeric columns in the data table
AllNumericColumns = dt << get column names( numeric, string );
AllNumericColumnsCompressed = AllNumericColumns;
// Uppercase and compress the column names
For( i = 1, i <= N Items( AllNumericColumns ), i++,
AllNumericColumnsCompressed[i] = Uppercase( AllNumericColumnsCompressed[i] );
While( Pat Match( AllNumericColumnsCompressed[i], " ", "" ) > 0, Pat Match( AllNumericColumnsCompressed[i], " ", "" ) );
);
// This iist is the list of the names used within JMP Contol Limits and is used by the script
// to set the type of contol limit being updated
ControlLimitList = {"XBar", "R", "S", "Individual Measurement", "Moving Range", "Median Moving Range", "P", "NP", "C", "U", "UWMA", "EWMA",
"CUSUM", "Levey Jennings", "Individual on Group Means", "Individual on Group Std Devs", "Moving Range on Group Means",
"Moving Range on Group Stds", "Median Moving Range on Group Means", "Median Moving Range on Group Std Devs", "Run Chart", "G", "T"};
// Variale used to set the length of the column selection list
nc = N Col( dt );
lbWidth = 160;
// Create a list of all of the open tables
list_tables = {};
For( i = 1, i <= N Table(), i++,
Insert Into( list_tables, Data Table( i ) << get name )
);
// Display the Limits Table Selection window
nw = New Window( "Populate Limits",
V List Box(
Spacer Box( size( 1, 5 ) ),
H List Box( IconBB = Button Box( "" ), IconTB = Text Box( "Populate Limits Column Property from a separate table" ) ),
Spacer Box( size( 1, 20 ) ),
TheHlB = H List Box(
V List Box(
Text Box( "Select Limits Table" ),
Spacer Box( size( 1, 2 ) ),
Panel Box( "Set Limits in " || Char( dt << get name ) || " with",
TableLB = List Box( list_tables, n lines( 6 ), width( 220 ) ),
)
)
),
Spacer Box( size( 1, 10 ) ),
H List Box(
Spacer Box( size( 10, 1 ) ),
createtableBB = Button Box( "Create Limits Table from Current Active Data Table", createlimitstable )
),
Spacer Box( size( 1, 10 ) )
),
// When the user selection for the limits data table changes, reset the column dialog boxes
TableLB << on change(
// Delete the button box
Try( createtableBb << delete );
// Blank out the low,avg and high lists
resetlists;
// Delete the current column dialog boxes
Try( clusterdlg << delete );
// If the user has selected a new limits table, reset the window
If( Try( (tablelb << get selected)[1], "" ) != "",
dtlimits = Data Table( (tablelb << get selected)[1] );
Current Data Table( dtlimits );
// Reinput the code for the column dialog boxes....this is
// required, because the col list boxes do not lose the data
// table references without totally deleting the col list box
// and bringing in new instances
clusterexpr;
// Add the col dialog boxes to the current display
theHLB << append( clusterdlg );
// Reset required lists
AllLimitColList = AllLimitColListCompressed = {};
Try( AllLimitColList = Column( dtlimits, Column Names ) << get values );
AllLimitColListCompressed = AllLimitColList;
// Uppercase and remove blanks from the column list
For( i = 1, i <= N Items( AllLimitColList ), i++,
AllLimitColListCompressed[i] = Uppercase( AllLimitColListCompressed[i] );
While( Pat Match( AllLimitColListCompressed[i], " ", "" ) > 0, Pat Match( AllLimitColListCompressed[i], " ", "" ) );
);
);
),
// Set the icon
iconbb << set icon( "Update" )
);
);
/*****************************************************************************/
/* */
/* Create a Limits Table populating limits from the current data table */
/* */
/*****************************************************************************/
CreateLimitsTable = Expr(
HasBeenSeen = Repeat( 0, 24 );
dtnew = New Table( "Limits Table", invisible, New Column( "Column Names", character, values( AllNumericColumns ) ) );
// Pass through all of the specified parameters and extract any limits found in the
// active data table and move them to the new limits data table
For( allvars = 1, allvars <= N Items( AllNumericColumns ), allvars++,
col = Parse( "dt:" || AllNumericColumns[allvars] );
// Gather in the already set Control and Spec Limits
controls = col << get property( "Control Limits" );
specs = col << get property( "Spec Limits" );
// Process Spec Limits
If( !(Char( specs ) == "Scriptable[]" | Is Empty( specs ) == 1),
If( HasBeenSeen[24] == 0,
dtnew << New Column( "LSL" );
dtnew << New Column( "Target" );
dtnew << New Column( "USL" );
HasBeenSeen[24] = 1;
);
For( i = 1, i <= N Items( specs ), i++,
If( Is Missing( Try( Specs["LSL"], . ) ) == 0,
dtnew:LSL[AllVars] = Specs["LSL"]
);
If( Is Missing( Try( Specs["Target"], . ) ) == 0,
dtnew:Target[AllVars] = Specs["Target"]
);
If( Is Missing( Try( Specs["LSL"], . ) ) == 0,
dtnew:USL[AllVars] = Specs["USL"]
);
);
);
// All of the Control limits have the same structure. This code extracts all of the different
// types of control limits and moves them to the limits table
If( !(Char( controls ) == "Scriptable[]" | Is Empty( controls ) == 1),
For( i = 1, i <= N Items( controls ), i++,
If( Contains( ControlLimitList, Trim( Word( 1, Char( controls[i] ), "(,)" ) ) ) > 0,
Control Limit Type = Trim( Word( 1, Char( controls[i] ), "(,)" ) );
LimitListNumber = Contains( ControlLimitList, Trim( Word( 1, Char( controls[i] ), "(,)" ) ) );
If( HasBeenSeen[LimitListNumber] == 0,
dtnew << New Column( ControlLimitList[LimitListNumber] || "LCL" );
dtnew << New Column( ControlLimitList[LimitListNumber] || "AVG" );
dtnew << New Column( ControlLimitList[LimitListNumber] || "UCL" );
HasBeenSeen[LimitListNumber] = 1;
);
For( ctype = 2, ctype <= 6, ctype = ctype + 2,
If( Trim( Word( ctype, Char( controls[i] ), "(,)" ) ) == "Avg",
Column( dtnew, ControlLimitList[LimitListNumber] || "AVG" )[AllVars] = Num(
Word( ctype + 1, Char( controls[i] ), "(,)" )
)
);
If( Trim( Word( ctype, Char( controls[i] ), "(,)" ) ) == "LCL",
Column( dtnew, ControlLimitList[LimitListNumber] || "LCL" )[AllVars] = Num(
Word( ctype + 1, Char( controls[i] ), "(,)" )
)
);
If( Trim( Word( ctype, Char( controls[i] ), "(,)" ) ) == "UCL",
Column( dtnew, ControlLimitList[LimitListNumber] || "UCL" )[AllVars] = Num(
Word( ctype + 1, Char( controls[i] ), "(,)" )
)
);
);
)
);
);
);
If( N Cols( dtnew ) == 1,
dtnew << New Column( "LSL" );
dtnew << New Column( "Target" );
dtnew << New Column( "USL" );
dtnew << New Column( "XBarLCL" );
dtnew << New Column( "XBarAVG" );
dtnew << New Column( "XBarUCL" );
);
Insert Into( List_Tables, "Limits Table" );
x = List_Tables;
TableLB << RemoveAll;
TableLB << append( list_tables );
dtnew << zoom window;
);
/*****************************************************************************/
/* */
/* Blank out all selections and reset to the current limit */
/* */
/*****************************************************************************/
resetLists = Expr(
lowList = avgList = highList = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
If( Try( LimitTypeRB << get, 1 ) == 1,
limitNum = 24,
LimitNum = cb << get
);
);
// Initialize the lists
ResetLists;
/*****************************************************************************/
/* */
/* Set the Control Limits for all specified control limits for a single */
/* row from the limits data table */
/* */
/*****************************************************************************/
SetControlLimits = Function( {c, CList, IgnoreMissing, i},
{c, CList, IgnoreMissing},
// Big List pulls in any existing limit control values. This allows for the addition of
// replacement of limit values without erasing any limits that currently exist.
c = AllNumericColumns[Contains( AllnumericColumnsCompressed, AllLimitColListCompressed[i] )];
biglist = Column( dt, c ) << getproperty( "control limits" );
// Roll across all of the types of contol limits found
For( cl = 1, cl <= N Items( CList ), cl++,
little = {__type__( Avg( avexpr ), UCL( ULexpr ), LCL( LLexpr ) )};
Substitute Into( little, Expr( __type__ ), Parse( controllimitnamesList[CList[cl]] ) );
// Get the new limits to be processed from the limits table
// If no column has been specified for one of the limits, a
// missing value is set
lcl = Try( Column( dtlimits, lowlist[CList[cl]] )[i], . );
tar = Try( Column( dtlimits, avglist[CList[cl]] )[i], . );
ucl = Try( Column( dtlimits, highlist[CList[cl]] )[i], . );
// If Control Limits were found interrogate them
If( Is Empty( biglist ) == 0,
For( _i_ = N Items( big list ), _i_ >= 1, _i_--,
If( Uppercase( Word( 1, biglist[_i_], "(" ) ) == Uppercase( controllimitnamesList[CList[cl]] ),
onelist = Char( biglist[_i_] );
xlcl = .;
xtarget = .;
xucl = .;
For( limitcnt = 2, limitcnt <= 7, limitcnt = limitcnt + 2,
alimit = Word( limitcnt, onelist, "(,)" );
If(
Contains( alimit, "LCL" ) > 0, xlcl = Num( Word( limitcnt + 1, onelist, "(,)" ) ),
Contains( alimit, "Avg" ) > 0, xtarget = Num( Word( limitcnt + 1, onelist, "(,)" ) ),
Contains( alimit, "UCL" ) > 0, xucl = Num( Word( limitcnt + 1, onelist, "(,)" ) )
);
);
Remove From( biglist, _i_ );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = xlcl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = xtarget;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = xucl;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
);
// If the limits do not currently exist, but other control limits are there,
// insert the new control limits into the large control limit list
If( Is Missing( lcl ) + Is Missing( tar ) + Is Missing( ucl ) > 0,
// If Missing values from the limits table are to signal not to
// change the current limit, then process them accoringly
If( IgnoreMissing == "No",
If( LowList[CList[cl]] != "",
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) ),
Substitute Into( little, Expr( LLexpr ), Eval( xlcl ) );
lcl = xlcl;
);
If( AvgList[CList[cl]] != "",
Substitute Into( little, Expr( avexpr ), Eval( tar ) ),
Substitute Into( little, Expr( avexpr ), Eval( xtarget ) );
tar = xtarget;
);
If( HighList[CList[cl]] != "",
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) ),
Substitute Into( little, Expr( ULexpr ), Eval( xucl ) );
ucl = xucl;
);
,
If( Is Missing( lcl ) == 1 | LowList[CList[cl]] == "",
Substitute Into( little, Expr( LLexpr ), Eval( xlcl ) );
lcl = xcl;
,
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) )
);
If( Is Missing( ucl ) == 1 | HighList[CList[cl]] == "",
Substitute Into( little, Expr( ULexpr ), Eval( xucl ) );
ucl = xucl;
,
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) )
);
If( Is Missing( tar ) == 1 | AvgList[CList[cl]] == "",
Substitute Into( little, Expr( avexpr ), Eval( xtarget ) );
tar = xtarget;
,
Substitute Into( little, Expr( avexpr ), Eval( tar ) )
);
)
,
// Just add the new limits if not concerned about preserving data
// and replacing limits if missing values have been specified
If( Is Missing( lcl ) + Is Missing( tar ) + Is Missing( ucl ) < 3,
If( LowList[CList[cl]] != "",
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) ),
Substitute Into( little,
Expr( LLexpr ),
Eval( xlcl );
lcl = xlcl;
)
);
If( AvgList[CList[cl]] != "",
Substitute Into( little, Expr( avexpr ), Eval( tar ) ),
Substitute Into( little, Expr( avexpr ), Eval( xtarget ) );
tar = xtarget;
);
If( HighList[CList[cl]] != "",
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) ),
Substitute Into( little, Expr( ULexpr ), Eval( xucl ) );
ucl = xucl;
);
)
);
// If the big list doesn't exist, create it
If( Is Empty( biglist ) == 1,
biglist = {}
);
// Add the current limit type to the overall list of control limits
Insert Into( biglist, little );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = lcl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = tar;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = ucl;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
)
,
// No control limits currently exist for the target column, so create the large
// control limit list by setting it equal to the new input limits
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = .;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = .;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = .;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
If( Is Missing( lcl ) + Is Missing( tar ) + Is Missing( ucl ) < 3,
If( LowList[CList[cl]] != "",
Substitute Into( little, Expr( LLexpr ), Eval( lcl ) ),
Substitute Into( little, Expr( LLexpr ), Eval( . ) );
lcl = .;
);
If( AvgList[CList[cl]] != "",
Substitute Into( little, Expr( avexpr ), Eval( tar ) ),
Substitute Into( little, Expr( avexpr ), Eval( . ) );
tar = .;
);
If( HighList[CList[cl]] != "",
Substitute Into( little, Expr( ULexpr ), Eval( ucl ) ),
Substitute Into( little, Expr( ULexpr ), Eval( . ) );
ucl = .;
);
);
// If the big list doesn't exist, create it
If( Is Empty( biglist ) == 1,
biglist = {}
);
// Add the current limit type to the overall list of control limits
Insert Into( biglist, little );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = lcl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = tar;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = controllimitnamesList[CList[cl]];
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = ucl;
dtReport:Limit[N Rows( dtReport )] = "Control Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
)
;
);
If( Char( biglist ) != "Scriptable[]" & Is Empty( biglist ) == 0 & biglist != {},
Column( dt, c ) << setproperty( "control limits", Eval( biglist ) )
);
);
/*****************************************************************************/
/* */
/* Set the Spec Limits for all specified control limits for a single */
/* row from the limits data table */
/* */
/*****************************************************************************/
SetSpecLimits = Function( {c, lsl, usl, avg, IgnoreMissing, showlims},
{c, lsl, usl, avg, IgnoreMissing, showlims},
// Get the current spec limits
Try( speclist = Column( dt, c ) << get property( "spec limits" ), {} );
Try( xlsl = speclist["LSL"], xlsl = . );
Try( xusl = speclist["USL"], xusl = . );
Try( xavg = speclist["Target"], xavg = . );
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = xlsl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = xavg;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = xusl;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "Previous";
// Process the limits
If( Is Missing( lsl ) + Is Missing( avg ) + Is Missing( usl ) < 3,
// If misssing value input is to be Ignored, that means that
// old values of the limits are to be moved forward if the new
// input values are missing values
If( IgnoreMissing == "Yes",
If( (Is Missing( xusl ) == 1 & Is Missing( usl ) == 0) | HighList[24] != "",
xusl = usl
);
If( (Is Missing( xlsl ) == 1 & Is Missing( lsl ) == 0) | LowList[24] != "",
xlsl = lsl
);
If( (Is Missing( xavg ) == 1 & Is Missing( avg ) == 0) | AvgList[24] != "",
xavg = avg
);
cmd = Expr(
Column( dt, c ) << SetProperty(
"Spec LImits",
{LSL( Expr( xlsl ) ), USL( Expr( xusl ) ), Target( Expr( xavg ) ), Show Limits( Expr( showlims ) )}
)
);
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = xlsl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = xavg;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = xusl;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
, // Else
If( LowList[24] == "",
lsl = xlsl
);
If( AvgList[24] == "",
avg = xavg
);
If( HighList[24] == "",
usl = xusl
);
cmd = Expr(
Column( dt, c ) << SetProperty(
"Spec LImits",
{LSL( Expr( lsl ) ), USL( Expr( usl ) ), Target( Expr( avg ) ), Show Limits( Expr( showlims ) )}
)
);
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport:Level[N Rows( dtReport )] = "Lower";
dtReport:Value[N Rows( dtReport )] = lsl;
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Average";
dtReport:Value[N Rows( dtReport )] = avg;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
dtReport << add Rows( 1 );
dtReport:Column[N Rows( dtReport )] = c;
dtReport:Limit Type[N Rows( dtReport )] = "_";
dtReport:Level[N Rows( dtReport )] = "Upper";
dtReport:Value[N Rows( dtReport )] = usl;
dtReport:Limit[N Rows( dtReport )] = "Spec Limit";
dtReport:OldNew[N Rows( dtReport )] = "New";
);
Eval( Eval Expr( cmd ) );
);
);
/*****************************************************************************/
/* */
/* Run through each of the columns in the limits table and call the functions*/
/* that update the limits, based upon what limits have been specified in the */
/* dialog input screen */
/* */
/*****************************************************************************/
runit = Expr(
ControlLimitNamesList = {"XBar", "R", "S", "Individual Measurement", "Moving Range", "Median Moving Range", "P", "NP", "C", "U", "UWMA", "EWMA",
"CUMSUM", "Levey Jennings", "Individual on Group Means", "Individual on Group Std Devs", "Moving Range on Group Means",
"Moving Range on Group Std Devs", "Median Moving Range on Group Means", "Median Moving Range on Group Std Devs", "Run Chart", "G", "T"};
// Create a list of which control limits have been specified
CList = {};
For( i = 1, i <= 23, i++,
If( LowList[i] || avgList[i] || highList[i] != "",
Insert Into( CList, i )
)
);
// If spec limits have been specified, setup a similar flag to the control limits
// to use for spec limit processing
SLList = {};
If( LowList[24] || avgList[24] || highList[24] != "",
Insert Into( SLList, 24 )
);
// Get Excluded Rows in the Limits Table so they can be bypassed in processing
Excluded Rows = As List( dtLimits << get excluded rows );
// Roll across the rows in the limits table and process the new limits
For( ii = 1, ii <= N Items( AllLimitColList ), ii++,
Process = "Yes";
If( N Items( Excluded Rows ) > 0,
If( Loc( Excluded Rows, ii ) > 0,
Process = "No",
Process = "Yes"
)
);
If( Process == "Yes",
targetName = AllNumericColumns[Contains( AllnumericColumnsCompressed, AllLimitColListCompressed[ii] )];
//ii=30
// If there are spec limits to be processed, call the setspeclimits function
If( N Items( SLList ) > 0,
return = setspeclimits(
Targetname,
Try( Column( dtlimits, lowlist[24] )[ii], . ),
Try( Column( dtlimits, highlist[24] )[ii], . ),
Try( Column( dtlimits, avglist[24] )[ii], . ),
IgnoreMissing,
showLims
)
);
// If Control limit changes have been specified, call the SetControlLimits function
If( N Items( CList ) > 0,
return = SetControlLimits( TargetName, CList, IgnoreMissing, ii )
);
);
);
ShowReport;
close(dtLimits, nosave );
dtLimits = dtOriginalLimits;
current data table(dt);
);
/*****************************************************************************/
/* */
/* Create and display a Summary Report */
/* */
/*****************************************************************************/
ShowReport = Expr(
If( N Rows( dtReport ) > 0,
// Calculate Required Scroll Bar Width
Current Data Table( dtReport );
Summarize( dtReport, Ltypes = By( :Limit Type ) );
hsize = N Items( Ltypes ) * 200 + 150;
// Generate a tabluate report for the display
tab = Tabulate(
Change Item Label( Statistics( Sum, " " ) ),
Remove Column Label( Grouping Columns( :Limit Type, :Limit, :OldNew ) ),
Show Control Panel( 0 ),
Include missing for grouping columns( 1 ),
Add Table(
Column Table( Grouping Columns( :Limit, :Limit Type, :OldNew ), Analysis Columns( :Value ) ),
Row Table( Grouping Columns( :Column, :Level ) )
),
SendToReport( Dispatch( {}, "Tabulate", OutlineBox, {Set Title( "Set Limits Report" )} ) )
);
Tab << on Close( Close( dtReport, nosave ) );
// Modify the output so the Tabulate table is in a scroll box of limited size
Report( tab ) << append( thescroll = Scroll Box( size( hsize, 700 ) ) );
thescroll << append( Report( Tab )[Box( 1 )] );
// Delete the non scroll box version of the table
Report( Tab )[Box( 1 )] << delete;
// If Non Processed columns are found in the data table, list them out
If( N Items( NotProcessedColumnsList ) > 0,
rptNotProcessedOB = Outline Box( "Columns Not Processed",
Border Box( top( 10 ), Left( 10 ), Right( 10 ), bottom( 10 ), sides( 15 ),
V List Box(
Spacer Box( size( 1, 10 ) ),
Text Box( "The following column(s) are in the data table" ),
Text Box( "but are not being processed because they were)" ),
Text Box( "not referenced in the limits table." ),
Spacer Box( size( 1, 10 ) ),
H List Box( Spacer Box( size( 60, 1 ) ), List Box( NotProcessedColumnsList ) ),
Spacer Box( size( 1, 10 ) ),
Text Box( "No limits will be set for the above referenced columns" ),
Spacer Box( size( 1, 10 ) )
)
)
);
rptNotProcessedOB << close;
Report( Tab ) << Append( rptNotProcessedOB );
);
// If columns were found in the limits table, but not in the data table
// list them out
If( N Items( NotFoundList ) > 0,
rptNotFoundOB = Outline Box( "Columns Not Found",
Border Box( top( 10 ), Left( 10 ), Right( 10 ), bottom( 10 ), sides( 15 ),
V List Box(
Spacer Box( size( 1, 10 ) ),
Text Box( "The following column(s) names(s) were referenced in the" ),
Text Box( "Limit Table, but no numeric column of that/those name(s)" ),
Text Box( "were found in the data table." ),
Spacer Box( size( 1, 10 ) ),
H List Box( Spacer Box( size( 60, 1 ) ), List Box( NotFoundList ) ),
Spacer Box( size( 1, 10 ) ),
Text Box( "No limits will be set for the above referenced columns" ),
Spacer Box( size( 1, 10 ) )
)
)
);
rptNotFoundOB << close;
Report( Tab ) << Append( Spacer Box( size( 1, 10 ) ) );
Report( Tab ) << Append( rptNotFoundOB );
);
)
);
/*****************************************************************************/
/* */
/* This is the display for the column selections where the user matches the */
/* the limit columns from the limit data table with the columns in the */
/* data table */
/* */
/*****************************************************************************/
clusterexpr = Expr(
all Columns List = dtlimits << get column names;
Current Data Table( dtlimits );
clusterDlg = V List Box(
Border Box( Left( 3 ), top( 2 ),
V List Box(
Text Box( "Select Columns to Read the Limits From" ),
H List Box(
V List Box(
// Generate the master display box for the columns in the data table
Panel Box( "Select Columns",
cldvlb = H List Box(
Popup Box(
{"Clear", filterval = "" ; thefilter << set text( "" ) ; clearit ; ,
"Numeric", filterval = "" ; thefilter << set text( "" ) ; clearit ; For( II = 1,
II <= N Items( All Columns List ), II++,
If( Column( All Columns List[II] ) << get data type != "Numeric",
colListData << set selected( II )
)
) ; colListData << remove selected ; ,
"Character", filterval = "" ; thefilter << set text( "" ) ; clearit ; For( II = 1,
II <= N Items( All Columns List ), II++,
If( Column( All Columns List[II] ) << get data type != "Character",
colListData << set selected( II )
)
) ; colListData << remove selected ; ,
"Name Contains", filterval = "" ; filtervlb << prepend(
V List Box(
thefilter = Text Edit Box( "",
<<SET width=""> 0;
// Check to see if the required data has been input
If(
N Items( colListY << GetItems ) == 0, Dialog( "No ID Column Specified", Button( "OK" ) ), // Else
LimitsChoosen == 0, Dialog( "No Limit Columns Specified", Button( "OK" ) ), // Else
RecallList = {lowlist = {}, avglist = {}, highlist = {}};
RecallList["lowlist"] = lowlist;
RecallList["avglist"] = avglist;
RecallList["highlist"] = highlist;
// Place the selected values from the screen into the recall list
Insert Into( RecallList, Parse( "IDColumn = \!"" || Char( (colListY << get items)[1] ) || "\!"" ) );
If( IgnoreCB << get == 1,
IgnoreMissing = "Yes",
IgnoreMissing = "No"
);
ShowLims = ShowCB << get;
ShowRpt = ReportCB << get;
Insert Into( RecallList, Parse( "IgnoreMissing = \!"" || IgnoreMissing || "\!"" ) );
Insert Into( RecallList, Parse( "ShowLims = " || Char( showlims ) ) );
Insert Into( RecallList, Parse( "ShowRpt = " || Char( showRpt ) ) );
// Save recall string to Recall namespace
Recall:WriteLimits = RecallList;
nw << CloseWindow;
dtReport = New Table( "Report",
Private,
New Column( "Column", Character, "Nominal" ),
New Column( "Limit Type", Character, "Nominal" ),
New Column( "Level",
Character,
"Nominal",
Set Property( "Value Ordering", {"Lower", "Average", "Upper"} )
),
New Column( "Value", Numeric, "Continuous", Format( "Best", 10 ) ),
New Column( "Limit",
Character,
"Nominal",
Set Property( "Value Ordering", {"Spec Limit", "Control Limit"} )
),
New Column( "OldNew", Character, "Nominal", Set Property( "Value Ordering", {"Previous", "New"} ) )
);
dtReport:Column << set property( "Row Order Levels", 1 );
// Create a working copy of the limits table
dtLimits << Select Rows( NotFoundListRowNumbers );
dtLimits << invert row selection;
dtLimitsTemp = dtLimits << subset(invisible, selected rows(1), selected columns(0));
dtLimits << clear select;
dtOriginalLimits = dtLimits;
dtLimits = dtLimitsTemp;
wait(0);
// Run the actual code that updates the limits
runit;
);
),
Button Box( "Cancel",
clusterDlg << CloseWindow;
Names Default To Here( 1 );
),
Text Box( " " ),
Button Box( "Remove",
colListY << RemoveSelected;
collower << remove selected;
colaverage << remove selected;
colupper << remove selected;
),
Button Box( "Recall",
If( Is List( Recall:WriteLimits ) == 1,
Eval List( Recall:WriteLimits );
If( Try( (colListY << get items)[1], "" ) != IDcolumn,
colListY << RemoveAll;
colListY << append( IDcolumn );
);
If( IgnoreMissing == "Yes",
IgnoreCB << set( 1 ),
IgnoreCB << set( 0 )
);
ShowCB << set( ShowLims );
ReportCB << set( ShowRpt );
readLimitColNames( LimitNum );
)
),
Button Box( "Help", notImplemented )
)
)
),
)
)
),
// Set the default values for the check box options
IgnoreCB << set( 1 );
IgnoreMissing = "Yes";
ShowCB << set( 1 );
ShowLims = 1;
ReportCB << set( 1 );
ShowRpt = 1;
);
// Write the names to the Limit Lists ffrom the display window
WriteLimitColNames = Function( {lNum},
LowList[LNum] = Try( (colLower << get items)[1], "" );
AvgList[LNum] = Try( (colAverage << get items)[1], "" );
HighList[LNum] = Try( (colUpper << get items)[1], "" );
);
// Read the limit values from the Limit Lists and populate
// the display window with the values
ReadLimitColNames = Function( {lNum},
{lNum},
tmplist = lowlist;
ColLower << remove all;
lowlist = tmplist;
tmplist = {};
Insert Into( tmplist, lowlist[lnum] );
collower << append( tmplist );
tmplist = avglist;
ColAverage << remove all;
avglist = tmplist;
tmplist = {};
Insert Into( tmplist, avglist[lnum] );
colAverage << append( tmplist );
tmplist = Highlist;
ColUpper << remove all;
Highlist = tmplist;
tmplist = {};
Insert Into( tmplist, Highlist[lnum] );
ColUpper << append( tmplist );
);
// When the value for the column that contains the names of the data
// table columns that will have their limits changed, process the list,
// comparing it to the data table to check for columns not found
ColListY << On Change(
If( Try( (ColListY << get items)[1], "" ) != LastColListY,
If( Try( N Items( colListY << get items ), 0 ) > 0,
AllLimitColList = AllLimitColListCompressed = NotProcessedColumnsList = NotProcessedColumnsListCompressed = {};
LastColListY = (ColListY << get items)[1];
If( Try( (colListY << get items)[1], "" ) != "",
AllLimitColList = Column( dtlimits, (colListY << get items)[1] ) << get values;
AllLimitColListCompressed = AllLimitColList;
NotFoundList = {};
NotFoundListRowNumbers = {};
// Uppercase and compress the column names
For( i = N Items( AllLimitColList ), i > 0, i--,
AllLimitColListCompressed[i] = Uppercase( AllLimitColListCompressed[i] );
While( Pat Match( AllLimitColListCompressed[i], " ", "" ) > 0, Pat Match( AllLimitColListCompressed[i], " ", "" ) );
If( Contains( AllNumericColumnsCompressed, AllLimitColListCompressed[i] ) == 0,
Insert Into( NotFoundList, AllLimitColList[i] );
Insert Into( NotFoundListRowNumbers, i );
AllLimitColListCompressed = Remove( AllLimitColListCompressed, i, 1 );
AllLimitColList = Remove( AllLimitColList, i, 1 );
);
);
// Find all of the columns that are not going to be processed
NotProcessedColumnsListCompressed = NotProcessedColumnsList = dt << get column Names( string );
For( i = N Items( NotProcessedColumnsList ), i > 0, i--,
NotProcessedColumnsListCompressed[i] = Uppercase( NotProcessedColumnsListCompressed[i] );
While( Pat Match( NotProcessedColumnsListCompressed[i], " ", "" ) > 0,
Pat Match( NotProcessedColumnsListCompressed[i], " ", "" )
);
If( Contains( AllLimitColListCompressed, NotProcessedColumnsListCompressed[i] ) > 0,
//Insert Into( NotFoundList, AllLimitColList[i] );
NotProcessedColumnsListCompressed = Remove( NotProcessedColumnsListCompressed, i, 1 );
NotProcessedColumnsList = Remove( NotProcessedColumnsList, i, 1 );
);
);
// If there are columns that do not exist in the data table, notify the user
If( N Items( NotFoundList ) > 0,
winLocation = nw << get window position;
err = New Window( "Columns Not Found",
Border Box( top( 10 ), Left( 10 ), Right( 10 ), bottom( 10 ), sides( 15 ),
V List Box(
Spacer Box( size( 1, 10 ) ),
Text Box( "The following column(s) names(s) were referenced in the" ),
Text Box( "Limit Table, but no numeric column of that/those name(s)" ),
Text Box( "were found in the data table." ),
Spacer Box( size( 1, 10 ) ),
H List Box( Spacer Box( size( 60, 1 ) ), List Box( NotFoundList ) ),
Spacer Box( size( 1, 10 ) ),
Text Box( "No limits will be set for the above referenced columns" ),
Spacer Box( size( 1, 10 ) ),
H List Box(
continueBB = Button Box( "Continue Anyway", err << close window ),
stopBB = Button Box( "Stop Script",
err << close window;
nw << close window;
Throw();
)
)
)
)
);
err << move window( winLocation[1] + 100, winLocation[2] + 100 ) << zoom window;
);
);
)
)
);
);
/*****************************************************************************/
/* */
/* An Expr to run for any function that has not been implemented. It */
// displays a dialog window telling the user that the function has not been */
/* implemented yet */
/* */
/*****************************************************************************/
notImplemented = Expr(
Dialog( "Feature Not Implemented Yet", Button( "OK" ) )
);
/*****************************************************************************/
/* */
/* Code used in the column selection filter to reset the selection box */
/* */
/*****************************************************************************/
clearit = Expr(
For( II = 1, II <= N Items( colListData << get items ), II++,
colListData << set selected( II )
);
colListData << remove selected;
colListData << append( all columns list );
);
// Call the main expr as the inital piece of script to be run
main;</SET>
.
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기안녕 tx넬슨 , 스크립트 감사합니다. 실행해보니 에러 없이 실행이 됩니다. 그러나 사양 제한을 보면 '일부 열' 스크립트에 대해 잘못된 제한 값이 할당됩니다....열 이름을 확인했는데 이름 지정이 문제가 아닙니다....잘되는 이유를 알 수 없습니다. 일부 열과 일부 coulmnsn에 대해,,,,, 내가 뭔가를 놓치고 있습니까? 도울 수 있니?
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기멋진 스크립트 감사합니다.Re: 제한 테이블에서 데이터 테이블로 제한 쓰기절대적으로 뛰어난 추가 기능. 훌륭한 시간 절약. 특히 "그래프 기준선으로 표시"가 자동으로 활성화됩니다.
공유해 주셔서 감사합니다.
필립
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기당신의 의견에 감사드립니다.JSL의 일부로 추가 기능을 실행하는 한 코드를 파헤치고 작업 부분을 꺼내야 합니다.코드는 함수와 EXPR로 구성되어 있으므로 대화 상자에서 호출되는 코드를 쉽게 제거할 수 있습니다.
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기훌륭한 애드인! 나는 프로젝트에 대해 같은 것을 작성하려고했습니다.
JSL을 통해 추가 기능을 실행할 수 있습니까? 내 애플리케이션에 사양 제한을 추가하는 프로세스를 자동화하고 싶습니다.
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기@MikeD_앤더슨 맞다. 추가 기능에는 JMP 12 이상이 필요합니다.
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기추가 기능과의 버전 호환성을 확인할 수 있습니다. 그는 그것을 12 이상으로 제한했을 수 있습니다. 라이선스 관리자에게 확인하는 것이 좋습니다. 버전 12 및 13에 대한 액세스 권한이 있다고 확신합니다. 정말 편리하다고 생각할 수 있는 많은 개선 사항이 있었습니다.
최상의,
중
Re: 제한 테이블에서 데이터 테이블로 제한 쓰기이 .jmpaddin 파일은 내 컴퓨터에 설치되지 않습니다.
이 문제가 있는 사람이 있습니까?

/온티