cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
KinKame
Level IV

how to change the column format for several columns

Hello

I have a table created thru summary feature.

I would like to using a for () loop (target column #3 to #9)

1) change format for fixed dec to Percent

2) add cell color

 

thank you

 

Lionel

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: how to change column format several columns

There are issues with your code.  The code below works, assuming the logic you are specifying is want you want.  The only statement that is not a valid statement is the << Justify Text("center").  It is only valid when referring to a display window text box.  The other errors are just improper references:

For( ii = 4, ii < 6, ii++,

       Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << Format( "Percent", 10, 1 );

       //<<justify text( "center" );

       For( RowNum = 1, RowNum <= N Rows( summary_executive_RNG_alignment ), RowNum++,

              If( 0 < Column( summary_executive_RNG_alignment, orignal_columns0[ii] )[RowNum] <= 0.6,

                     Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "RED", RowNum ),

                     If( 0.6 < Column( summary_executive_RNG_alignment, ii )[RowNum] <= 0.9,

                           Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "Blue", RowNum ),

                           Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "GREEN", RowNum )

                     )

              )

       );

);

Jim

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: how to change column format several columns

Here is some sample code that I think will give you guidance on how to change the formats and the cell colors

Names Default To Here( 1 );

dt = Current Data Table();

// Change the formats

For( i = 3, i <= 9, i++,

       Column( dt, i ) << Format( "Percent", 9, 2 )

);

// Set cell colors

For( rownum = 1, rownum <= N Rows( dt ), rownum++,

       If( Column( dt,3 )[RowNum] <= .5,

              Column( dt,3 ) << color cells( "Blue", RowNum ),

              Column( dt,3 ) << color cells( "Green", RowNum )

       )

);

Jim
KinKame
Level IV

Re: how to change column format several columns

Hello Jim

ok just using the column property (table, column number) ...

the set color is cool. JMP allows data manipulation in a nice way ...

thank ou very much.

very instructive post

KinKame
Level IV

Re: how to change column format several columns

Jim,

I was trying to get a double For to address all row (as in your example) and multiple columns ...

but no success. Any idea?

For(ii=4, ii<11, ii++,

       Column(summary_executive_RNG_alignment, orignal_columns0[ii])

            << Format("Percent", 10, 1 );

            << justify text("center");

            For( RowNum = 1, RowNum <= N Rows( summary_executive_RNG_alignment ), RowNum++,

                 If( 0 < Column( summary_executive_RNG_alignment, orignal_columns0[ii])[RowNum] <= 0.6,

                      Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "RED", RowNum ),

                      If(0.6 < Column( summary_executive_RNG_alignment, ii ) <= 0.9,

                           Column( summary_executive_RNG_alignment, orignal_columns0[ii]) << color cells( "Blue", RowNum ),

                           Column( summary_executive_RNG_alignment, orignal_columns0[ii]) << color cells( "GREEN", RowNum )

                      )

            )

       )

);

txnelson
Super User

Re: how to change column format several columns

There are issues with your code.  The code below works, assuming the logic you are specifying is want you want.  The only statement that is not a valid statement is the << Justify Text("center").  It is only valid when referring to a display window text box.  The other errors are just improper references:

For( ii = 4, ii < 6, ii++,

       Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << Format( "Percent", 10, 1 );

       //<<justify text( "center" );

       For( RowNum = 1, RowNum <= N Rows( summary_executive_RNG_alignment ), RowNum++,

              If( 0 < Column( summary_executive_RNG_alignment, orignal_columns0[ii] )[RowNum] <= 0.6,

                     Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "RED", RowNum ),

                     If( 0.6 < Column( summary_executive_RNG_alignment, ii )[RowNum] <= 0.9,

                           Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "Blue", RowNum ),

                           Column( summary_executive_RNG_alignment, orignal_columns0[ii] ) << color cells( "GREEN", RowNum )

                     )

              )

       );

);

Jim
KinKame
Level IV

Re: how to change column format several columns

Thank you for your fast feedback.

will study the code you proposed :)

best regards

Lionel