The script fails because there is not a column defined called:
Zero to Three 3
The log issues the following error
Scoped data table access requires a data table column or variable in access or evaluation of 'dt:zero to three 3' , dt:zero to three 3/*###*/
This can be handled in several ways. If you want to continue using "Hard Coding" you can overcome the issue with the "Try" function:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt << New Column( "zero to three", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 2", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 4", formula( Random Integer( 0, 3 ) ) );
Try( dt:zero to three << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Try( dt:zero to three 2 << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Try( dt:zero to three 3 << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Try( dt:zero to three 4 << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Or, you can get a little more advanced and look and see if what names match the pattern you want, and if it does match it, then apply the color gradient:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt << New Column( "zero to three", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 2", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 4", formula( Random Integer( 0, 3 ) ) );
ColNames = dt << get column names( string, numeric );
For( i = 1, i <= N Items( ColNames ), i++,
If( Contains( Uppercase( ColNames[i] ), "ZERO TO THREE" ) == 1,
Column( dt, ColNames[i] ) << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value
)
);
Is this the issue you are trying to work around?
Jim