您好,我有一组列,其中包含按行排列的多个产品的数据。 我需要通过创建具有产品名称后缀的新的相同列来拆分此数据,并仅复制先前列中匹配的产品数据。 我只需要帮助来复制适当的数据。 我试图通过选择和复制粘贴来做到这一点,但我不知道该怎么做。 感兴趣区域加粗+下划线。
Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << Get Column Names(String);
//Select set of columns to split
for (i = nitems(colNames), i > 0, i--,
if (!contains(colNames[i], "SPC"),
remove from(colNames, i);
);
);
//Add new columns with product name suffix and copy/paste properties
Summarize(unique_values=by(:Products));
colNames2=colNames;
for (k = nitems(unique_values), k > 0, k--,
for (i = nitems(colNames), i > 0, i--,
colNames2[i] = colNames[i] || " " || unique_values[k];
dt << New Column( colNames2[i] );
);
for( j = 1, j <= nitems(colNames), j++,
colProps = Column( dt, colNames[j] ) << Get Column Properties;
Column( dt, colNames2[j] ) << Add Column Properties( colProps );
);
<U><STRONG> dt << Select Where( :Products == unique_values[k] );
dt << selectColumns(colNames);
dt << Copy;
dt << selectColumns(colNames2);
dt << Paste;</STRONG></U>
);