- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Color cells
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
Depending on how this will be used, there are few options. Simplest option and what will get you going is to open new script file from File menu
Then copy paste the script to that window which will open
Check that you have correct table from the top "toolbar" (it should be if it was last active when you did open the new script file).
Then Press Run Script from the toolbar
If this must be done repeatedly, you could make that script into a toolbar item, add-in, table script, script file... depending on the use
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
If you want it done to each column, you could use this script.
For Each( {col}, dt << Get Column Names( "String" ),
Eval(
Eval Expr(
dt << Select Where( Is Missing( As Column( Expr( col ) ) ) );
Expr( Column( col ) ) << Color Cells( "gray" );
dt << Clear Select;
)
)
);
*edit
The Expr() and all that are completely unnecessary. @jthi pointed that out with his example.
For Each( {col}, dt << Get Column Names( "String" ),
dt << Select Where( Is Missing( As Column( col ) ) );
Column( col ) << Color Cells( "gray" );
dt << Clear Select;
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
@mmarchandTSI you might also want to add check that some rows are selected (<< Color Cells will otherwise color all the cells).
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(3),
Compress File When Saved(1),
New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([., ., 1])),
New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([., ., .])),
New Column("Column 3", Numeric, "Continuous", Format("Best", 12), Set Values([2, 3, 4]))
);
For Each({col}, dt << Get Column Names("String"),
dt << Select Where(Is Missing(As Column(col)));
Column(col) << Color Cells("gray");
dt << Clear Select;
);
/*
For Each({col}, dt << Get Column Names("String"),
dt << Select Where(Is Missing(As Column(col)));
If(N Items(dt << Get Selected Rows) > 0,
Column(col) << Color Cells("gray");
);
dt << Clear Select;
);
*/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
Should be okay, because <<Select Where only adds to the current selection when the "extend" option is specified. Default is to select only rows that satisfy the conditions. Could amend the <<Select Where to be safe.
dt << Select Where( Is Missing( As Column( col ) ), current selection( "clear" ) )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
What I meant is that if there are no rows selected at all, all the cells in that column will be colored.
In this case all the cells in Age will get colored because there are no rows selected
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
wait(1);
:Age << Color Cells("Red");
wait(1);
dt << Select Rows([2,4,6,20]);
:Name << Color Cells("Blue");
dt << Clear Select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
Yes, good point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
If by graying-out you mean changing the cell color, easiest options are most likely script based. One option is using << Get Rows Where to get the rows which you want to color and then using << Color Cells to set the color to those rows
Names Default To Here(1);
dt = Current Data Table();
For Each({colname}, dt << Get Column Names("String"),
rows_to_color = dt << Get Rows Where(Is Missing(Column(dt, colname)[]));
Column(dt, colname) << Color Cells("Gray", rows_to_color);
dt << Clear Select;
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
Hi Jarmo,
Where can I add this option? sorry I'm new using JMP software.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
Depending on how this will be used, there are few options. Simplest option and what will get you going is to open new script file from File menu
Then copy paste the script to that window which will open
Check that you have correct table from the top "toolbar" (it should be if it was last active when you did open the new script file).
Then Press Run Script from the toolbar
If this must be done repeatedly, you could make that script into a toolbar item, add-in, table script, script file... depending on the use
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Color cells
Perfect! Thank you for your help. I really appreciate it.