Skript zum dynamischen Durchlaufen und Gruppieren von Spalten nach NamenAlso versuche ich, das herauszufinden, und es funktioniert einfach nicht ganz.
Ich habe eine Tabelle mit einem Schlüsselwertpaar, das ich von Tall nach Wide SPLIT habe. Am Ende habe ich ungefähr 10.000 Spalten, die alle eine regelmäßige Namensstruktur haben, wie z
"15.02.0 Param1", "15.02 Param2", "15.02 Param3"...."15.03 Param1", "15.03 Param2", "15.03 Param3",...
Wie kann ich all diese Spalten durchsehen und sie dynamisch nach dem Anfangsbegriff gruppieren? dh. alle 15,02 % Spalten in einer Gruppe, alle 15,03 % Spalten, alle 15,04 %, ... alle 17,06 % .... und die Gruppe anhand der Gruppierungsnummer benennen?
Mein Skript gruppiert einfach alles in einer einzigen Gruppe. 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, :EquipmentId, :ChamberId, :LotId, :SlotNo ))
);
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();
);SkripterstellungBetreff: Skript zum dynamischen Durchlaufen und Gruppieren von Spalten nach NamenEs gibt viele Möglichkeiten, dies zu tun.
Hier ist ein Beispiel, das zuerst die Gruppen in ein assoziatives Array aufbaut, wobei der Schlüssel als Name der Gruppe und der Wert eine Liste der Spalten in der Gruppe ist, und dann dieses assoziative Array durchläuft, um Spalten in der Datentabelle zu gruppieren. Um Gruppennamen zu erhalten, verwenden wir die Word()-Funktion für die Spaltennamen. Dies erfordert JMP16, da For Each verwendet wird
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);
);

Betreff: Skript zum dynamischen Durchlaufen und Gruppieren von Spalten nach Namendanke, werde das gleich ausprobieren.
Aber was ist mit dem dynamischen Erstellen der Gruppierungs-Array-Liste? Grundsätzlich sollte jeder eindeutige Wert von :RecipeStepId ein Groupby-Name sein. Ich habe das am Anfang versucht, bevor ich die Tabelle geteilt und im "RecipeStepIndex" gespeichert habe.
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
Betreff: Skript zum dynamischen Durchlaufen und Gruppieren von Spalten nach NamenSie könnten das assoziative Array zum Beispiel mit den Spaltennamen basierend auf RecipeStepIndex „vorausfüllen“. Höchstwahrscheinlich wird RecipeStepIndex am Anfang der geteilten Spaltennamen gefunden, daher sollte dies immer noch funktionieren.
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);
);