列を名前ごとにループして動的にグループ化するスクリプトそれで私はこれを理解しようとしていますが、まったく機能しません。
キーと値のペアを含むテーブルを Tall から Wide に分割しました。 最終的に、次のような規則的な名前構造を持つ約 10,000 列が作成されます。
「15.02.0 param1」、「15.02 param2」、「15.02 param3」....「15.03 param1」、「15.03 param2」、「15.03 param3」...
これらすべての列を調べて、開始用語ごとに動的にグループ化するにはどうすればよいですか?つまり。グループ内のすべての 15.02% 列、すべての 15.03% 列、すべての 15.04%、... すべての 17.06%...そして groupby 番号に基づいてグループに名前を付けますか?
私のスクリプトは、すべてを 1 つのグループにグループ化するだけです。うーん。
//**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: 列を名前で動的にループしてグループ化するスクリプトこのエラーは、連想配列にキーがないことを意味すると思います。 2 番目のコードを試した場合、コードに次の行が含まれていますか?
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
これは、aa_groups を初期化するために使用されます。 また、レシピステップインデックスと一致しません列グループ = Word(1, 列名, " ");そのエラーが発生します。 このような場合には、追加の処理を追加する必要がある場合があります (欠落している列をすべて収集するグループを追加するか、見つかった列のみを追加します)。
これにより、一致するグループがない列はスキップされます。
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: 列を名前で動的にループしてグループ化するスクリプトOK、あなたが言いたいことは分かったと思います。なぜ新しい dt を作成するのか混乱しましたが、単なる例のように見えます。
2 番目のコード セットは機能しないようですが、最初のコード セットは機能しました。 このエラーが何を意味するかわかりますか?

//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 が存在するのは、グループ化する列を含むデータ テーブルであるためです。 上記のコードでは、それへの参照が欠落しています。これを追加する最も簡単で最良の方法は次のとおりです (これにより、機能するかどうかわからない Current Data Table() の使用が回避されます)。
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 のそれぞれの一意の値は groupby 名である必要があります。 テーブルを分割する前に、最初にそれを実行して、「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 が決定される部分を変更し、それに応じて続行します。