동적으로 이름별로 열을 반복하고 그룹화하는 스크립트그래서 나는 이것을 알아 내려고 노력하고 있으며 제대로 작동하지 않습니다.
Tall에서 Wide로 분할한 키-값 쌍이 있는 테이블이 있습니다. 나는 모두 규칙적인 이름 지정 구조를 가진 약 10,000개의 열로 끝납니다.
"15.02.0 매개변수1", "15.02 매개변수2", "15.02 매개변수3"...."15.03 매개변수1", "15.03 매개변수2", "15.03 매개변수3",...
이 모든 열을 살펴보고 시작 용어로 동적으로 그룹화하려면 어떻게 해야 합니까? 즉. 그룹의 모든 15.02% 열, 모든 15.03% 열, 모든 15.04%, ... 모든 17.06%.... 그리고 groupby 번호를 기반으로 그룹 이름을 지정합니까?
내 스크립트는 모든 것을 단일 그룹으로 그룹화합니다. ug.
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))<BR />
);
dtAggWide = current data table();
ColNamesList = dtAggWide << get column names(string, continuous); //get the column names of the WIDE table
//Create an empty list for the matching columns
RecipeStepList = {};
// Find matching column names
For( i = 1, i <= N items( RecipeStepIndex ), i++,
For( j = 1, j <= N Items( ColNamesList ), j++,
If(
Contains( ColNamesList[j], RecipeStepIndex[i] ),
Insert Into( RecipeStepList, ColNamesList[j] ),
);
);
);
// If groups of columns are found, create Col groupings
If( N Items( RecipeStepList ) > 0,
dtAggWide << select columns( RecipeStepList );
dtAggWide << group columns();
);데이터 혼합 및 정리Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.잡았다. 두 버전을 모두 작동시키는 방법을 알아냈습니다! 큰 감사와 찬사를 보냅니다.
미래의 누군가를 위해 완성된 버전은 다음과 같습니다.
V1=
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
//Build and prefill an Array of names of the RecipeStepId
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))
);
//Group the Cols by name of RecipeStepId
col_list = dtAggWIDE << Get Column Names("String"); //get the col list
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = Eval List({col_name});
,
Insert Into(aa_groups[col_group], col_name);
);
);
For Each({{key, value}}, aa_groups, //perform the grouping
dtAggWide << Group Columns(key, value);
);
V2=
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
//Build and prefill an Array of names of the RecipeStepId
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
aa_groups = Associative Array();
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))
);
//Group the Cols by name of RecipeStepId
col_list = dtAggWide << Get Column Names("String");
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = {};
);
Insert Into(aa_groups[col_group], col_name)
);
For Each({{key, value}}, aa_groups, //perform the grouping
dtAggWide << Group Columns(key, value);
);Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.그 오류는 연관 배열에 키가 없다는 것을 의미한다고 생각합니다. 두 번째 코드를 시도한 경우 코드에 다음 줄이 있습니까?
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
aa_groups를 초기화하는 데 사용됩니다. 또한 만약 RecipeStepIndex 와 일치하지 않는다 col_group = Word(1, col_name, " "); 당신은 그 오류를 얻을 것이다. 그런 경우에 대한 추가 처리를 추가해야 할 수도 있습니다(누락된 모든 열을 수집하는 그룹 추가 또는 발견된 열만 추가).
일치하는 그룹이 없는 열은 건너뛰어야 합니다.
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = Eval List({col_name});
,
Insert Into(aa_groups[col_group], col_name);
);
);
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.알겠습니다. 무슨 말씀인지 알 것 같습니다. 새 dt를 생성하는 이유가 혼란스러웠지만 예를 위한 것 같습니다.
두 번째 코드 세트는 작동하지 않는 것 같지만 첫 번째 세트는 작동했습니다. 이 오류가 무엇을 의미하는지 아십니까?

//Group the Cols by name of RecipeStepId
col_list = dtAggWIDE << Get Column Names("String");
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = {};
);
Insert Into(aa_groups[col_group], col_name)
);
Show(aa_groups);
For Each({{key, value}}, aa_groups,
dtAggWide << Group Columns(key, value);
);
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.dtAggWide는 그룹화하려는 열이 있는 데이터 테이블이기 때문에 존재합니다. 위의 코드에서 참조가 누락되었습니다. 추가하는 가장 쉽고 가장 좋은 방법은 다음과 같습니다(이렇게 하면 작동하거나 작동하지 않을 수 있는 현재 데이터 테이블() 사용을 피할 수 있습니다).
dtAggWide = dt << Split(
Split By( :RecipeStepId, :RecipeStepName, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))
);
그리고 col_list는 dtAggWide의 열을 반복한 다음 aa_groups 연관 배열의 올바른 목록에 열을 추가합니다.
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.흠. 나는 약간 붙어 있고 당신이 여기서 무엇을하는지 잘 모르겠습니다.
왜 여전히 dtAggWide 및 col_list가 있습니까?
//*****************************************************************
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
//Build and prefill an Array of names of the RecipeStepId
aa_groups = Associative Array();
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :RecipeStepName, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))
);
//Group the Cols by name of RecipeStepId
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
Insert Into(aa_groups[col_group], col_name)
);
For Each({{key, value}}, aa_groups,
dtAggWide << Group Columns(key, value);
);Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.예를 들어 RecipeStepIndex를 기반으로 하는 열 이름으로 연관 배열을 "미리 채울" 수 있습니다. 대부분의 RecipeStepIndex는 분할 열 이름의 시작 부분에서 찾을 수 있으므로 여전히 작동해야 합니다.
Names Default To Here(1);
// this solution requires JMP16
dtAggWide = New Table("Untitled",
Add Rows(0),
New Column("15.02.0 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param2", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
col_list = dtAggWide << Get Column Names("String");
// first get the column group names and columns// in this solution case we use associative array
aa_groups = Associative Array();
//Summarize(dt, RecipeStepIndex = by(:RecipeStepId));//get list of unique RecipeStepID's
RecipeStepIndex = {"15.02.0", "15.03"};
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
Insert Into(aa_groups[col_group], col_name)
);
For Each({{key, value}}, aa_groups,
dtAggWide << Group Columns(key, value);
);
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.감사합니다. 곧 시도하겠습니다.
그러나 그룹화 배열 목록을 동적으로 구축하는 것은 어떻습니까? 기본적으로 :RecipeStepId의 각 고유 값은 그룹별 이름이어야 합니다. 처음에 테이블을 분할하기 전에 "RecipeStepIndex"에 저장하려고 했습니다.
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트입니다.이를 수행하는 방법에는 여러 가지가 있습니다.
다음은 그룹의 이름이 키이고 값이 그룹의 열 목록인 연관 배열로 그룹을 먼저 빌드한 다음 해당 연관 배열을 반복하여 데이터 테이블의 열을 그룹화하는 한 가지 예입니다. 그룹 이름을 얻으려면 열 이름에 Word() 함수를 사용합니다. For Each를 사용하기 때문에 JMP16이 필요합니다.
Names Default To Here(1);
// this solution requires JMP16
dtAggWide = New Table("Untitled",
Add Rows(0),
New Column("15.02.0 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param2", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
col_list = dtAggWide << Get Column Names("String");
// first get the column group names and columns<BR />// in this solution case we use associative array
aa_groups = Associative Array();
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = {};
);
Insert Into(aa_groups[col_group], col_name)
);
Show(aa_groups);
For Each({{key, value}}, aa_groups,
dtAggWide << Group Columns(key, value);
);

Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트특정 캐릭터를 검색한 다음 이를 그룹 이름으로 사용하는 방법은 없나요? 그렇게 하면 첫 번째 섹션의 동적 길이가 되나요?
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트col_group이 결정된 부분을 수정하고 그에 따라 계속 진행합니다.