Bedingte Formatierung von Spalten in einem TabellenfeldHallo, ich möchte eine einzelne bedingte Formatierungsregel auf zwei Datenspalten in einem Tabellenfeld anwenden. Ich habe unten ein Beispiel mit dem Big-Class-Datensatz erstellt, das das Problem veranschaulicht, bei dem ich in einer Datentabelle problemlos tun kann, was ich will, aber den gleichen Effekt in einer Tabellenbox zu erzielen scheint etwas schwieriger zu sein.
Der Mechanismus zum Erstellen des bedingten Formats für eine Spalte einer Tabellenbox unterscheidet sich völlig von dem für eine Datentabelle erforderlichen und erfordert, dass ich wie gezeigt eine Regel in meinen Einstellungen einrichte. Dieser Teil ist recht einfach, aber ich sehe keine Möglichkeit, diese Regel auf eine andere Spalte als die anzuwenden, auf die sich die Regel direkt bezieht. Kann es gemacht werden?
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>
Betreff: Bedingte Formatierung von Spalten in einem TabellenfeldVielen Dank, Jim – das ist genial!
Nur zur Information: Ich füge unten eine Kopie einer modifizierten Version meines ursprünglichen Skripts hinzu, die Ihre Empfehlung zur Lösung des Problems enthält. Nochmals vielen Dank – das wird mir phänomenal nützlich sein.
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>
Betreff: Bedingte Formatierung von Spalten in einem TabellenfeldIch habe keine Lösung, die eine bedingte Formatierungsregel erstellt. Ich habe jedoch erreicht, was Sie wollten, indem ich die farbige Datentabelle in ein Journal verschoben und dann TableBox(1) aus diesem Journal in die Anwendung eingefügt habe, die ich erstelle
