对表格框中的列进行条件格式设置您好 - 我想将单个条件格式规则应用于表框中的两列数据。 我在下面设置了一个使用 Big Class 数据集的示例来说明问题,其中我可以轻松地在数据表中执行我想要的操作,但在表框中产生相同的效果似乎有点棘手。
为表格框的列创建条件格式的机制与数据表所需的机制完全不同,并且要求我在首选项中设置规则,如图所示。 这部分很简单,但我看不到一种方法将该规则应用于与该规则直接相关的列以外的列。 能做到吗?
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
// Color-code blue all pupils whose height is at least 60, with everybody else purple;
// First color every cell in both the name and height columns purple;
Column( dt, "name" ) << color cells( RGB Color( 255, 0, 255 ), Index( 1, N Row( dt ) ) );
Column( dt, "height" ) << color cells( RGB Color( 255, 0, 255 ), Index( 1, N Row( dt ) ) );
// Now find everybody whose height is at least 60, and color them blue;
CellsToPaint = dt << get rows where( :Height >= 60 );
Show( CellsToPaint );
// Color them all blue;
Column( dt, "name" ) << color cells( RGB Color( 100, 100, 255 ), CellsToPaint );
Column( dt, "height" ) << color cells( RGB Color( 100, 100, 255 ), CellsToPaint );
// Now I'll try to produce the same effect with those two columns in a table box;
// Create a copy of the Big Class data table in a table box;
My_TB = Table Box( <<SET shade="" alternate="" rows=""></SET>
回复:对表格框中的列进行条件格式设置非常感谢吉姆 - 这太巧妙了!
仅供记录,我在下面添加了原始脚本的修改版本的副本,其中包含您关于如何解决此问题的建议。 再次感谢 - 这对我来说非常有用。
Clear Log();
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
// Color-code blue all pupils whose height is at least 60, with everybody else purple;
// First color every cell in both the name and height columns purple;
Column( dt, "name" ) << color cells( RGB Color( 255, 0, 255 ), Index( 1, N Row( dt ) ) );
Column( dt, "height" ) << color cells( RGB Color( 255, 0, 255 ), Index( 1, N Row( dt ) ) );
// Now find everybody whose height is at least 60, and color them blue;
CellsToPaint = dt << get rows where( :Height >= 60 );
Show( CellsToPaint );
// Color them all blue;
Column( dt, "name" ) << color cells( RGB Color( 100, 100, 255 ), CellsToPaint );
Column( dt, "height" ) << color cells( RGB Color( 100, 100, 255 ), CellsToPaint );
// Now I'll produce the same effect with those two columns in a table box using Jim's suggestion;
// Export it to the journal as a data table, which converts it into a TableBox in the process;
dt << journal;
// Pull it back again as a TableBox, putting into a window with any other objects that I might want to incorporate;
nw = New Window( "My Window",
Lineup Box( N Col( 1 ),
Text Box( "Clever, huh?" ),
Border Box( Current Journal()[Table Box( 1 )], <<SIDES></SIDES>
回复:对表格框中的列进行条件格式设置我没有可以创建条件格式规则的解决方案。 然而,我已经完成了你想要的,通过将彩色数据表移动到日记中,然后将 TableBox(1) 从该日记附加到我正在创建的应用程序中
