你好,
我目前正在编写一个脚本,使用Join,Transpose和Update函数将三个“引用”表本质上连接在一起。每次我向第一个“引用”表中添加行时,我的脚本都允许更新最终输出表。
我想知道是否可以编辑脚本以根据第一个“引用”表中的列的值自动将最终输出表中的列(即“组列”功能)分组?此列未包含在任何表函数中,因为它会引起转置问题。对于最终表的每次更新,保留这些分组非常重要。
感谢您提供的任何反馈意见。
布莱恩·D
这是您要找的东西吗?
Names Default To Here( 1 );
dt1 = New Table( "table1", add rows(1), New Column( "test", set values( [1] ) ) );
dt2 = New Table( "table2", add rows(2),
new column( "x1", character, set values( {"a", "b"} ) ),
New Column( "x2", character, set values( {"c", "d"} ) )
);
If( dt1:test[1] == 1,
dt2 << combine columns( delimiter( "," ),
columns( dt2:x1, dt2:x2 ), Column Name( "Combined" ) )
);在“脚本编制”索引中查看“组列”的用法。
这是您所说的一种方法
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt2 = New Table( "groupings",
New Column( "ID", character, set values( {"name", "age", "sex", "height", "weight"} ) ),
New Column( "Type", character, set values( {"A", "B", "C", "B", "A"} ) )
);
// Split data into columns based on Type
dtSplit = dt2 << Split( Split By( :Type ), Split( :ID ), Sort by Column Property );
// Process through the Split data table, creating the groups in the first data table
For( Group = 1, Group <= N Cols( dtSplit ), Group++,
theGroup = Column( dtSplit, Group ) << get values;
For(i=nitems(theGroup), i>=1,i--,if(theGroup[i] == "",
remove from(thegroup,i,1)));
grouping = dt << group columns( theGroup ); <BR /><BR /><FONT face="Consolas,Monaco,"Andale Mono","Ubuntu Mono",monospace" size="2" style="background-color: #f5f5f5;" color="#b00000">dt << Rename Column Group( grouping, (column(dtSplit, group)<<GET name="">
);</GET></FONT>