<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to retain the cell color after saving the data table into journal or new window in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/99285#M38792</link>
    <description>&lt;P&gt;Which version of JMP do you have?&amp;nbsp; Did you use this script or a modified script? If modified, please attach.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 19:41:51 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2019-01-07T19:41:51Z</dc:date>
    <item>
      <title>How to retain the cell color after saving the data table into journal or new window</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/92893#M38763</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*
After save dt into Journal, the cell color from data data table was changed into the font color in the journal
*/
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; Color by Column( :age);
Wait( 0 );
dt &amp;lt;&amp;lt; Color Rows by Row State;
dt&amp;lt;&amp;lt;save();
dt&amp;lt;&amp;lt; Clear column selection();
dt &amp;lt;&amp;lt; clear select;
win = New Window( "New Window", dt&amp;lt;&amp;lt;Journal);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 23:15:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/92893#M38763</guid>
      <dc:creator>wu</dc:creator>
      <dc:date>2019-01-04T23:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to retain the cell color after saving the data table into journal or new window</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/96305#M38773</link>
      <description>&lt;P&gt;The table message&amp;nbsp; &lt;STRONG&gt;dt &amp;lt;&amp;lt; Color Rows By Row State()&lt;/STRONG&gt; seems to be a "view" statement. The table view is changed, but saving the table and opening it or journaling does not maintain the colored cells.&amp;nbsp; Journaling that table will create a report in the Journal with the table font colors rmatching the row state colors.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However,&amp;nbsp; &lt;STRONG&gt;col &amp;lt;&amp;lt; Color Cells( clr, rows)&lt;/STRONG&gt; is a column message. This message is stored in the&amp;nbsp; table column's attributes. Also when journaling the cell color is maintained.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below both script and result are displayed below. Note another method (might be more direct) would be to get the unique keys for each group (age), get the rows for each age, then&amp;nbsp; pick a color and apply it to those rows of each column.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; Color by Column( :age );
Wait( 0 );

//This next command does not save the cell colors.
//dt &amp;lt;&amp;lt; Color Rows by Row State; 
dt &amp;lt;&amp;lt; Clear column selection();
dt &amp;lt;&amp;lt; clear select;

//get the unique colors
nr = N Row( dt );
//make a list the size of the table to get the row colors and locate rows of a given color

_clr = As List( J( nr, 1, 0 ) );  

For( i = 1, i &amp;lt;= N Row( dt ), i++,
	_clr[i] = Color To RGB( Color Of( Row State( i ) ) )
);

//creates a list of unique colors
clr_keys = Associative Array( _clr ) &amp;lt;&amp;lt; get keys;

//for each color (j), locate which rows are assigned that color using Loc( _clr, ...)
For( j = 1, j &amp;lt;= N Items( clr_keys ), j++,
	
	idx = Loc( _clr, clr_keys[j] );
//Color the cells in rows idx and each coloumn	
	For( i = 1, i &amp;lt;= N Col( dt ), i++,
		Column( dt, i ) &amp;lt;&amp;lt; color cells( RGB Color( clr_keys[j] ), idx )
	);
	
);

//now journal the table
dt &amp;lt;&amp;lt; journal;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15020i50EE4F4F79035F11/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 09:51:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/96305#M38773</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-01-06T09:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to retain the cell color after saving the data table into journal or new window</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/99233#M38790</link>
      <description>Could not duplicate your result of retaining cell color in journal,&lt;BR /&gt;Not sure if it is because you use JMP-Pro and mine is not.&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 07 Jan 2019 19:21:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/99233#M38790</guid>
      <dc:creator>wu</dc:creator>
      <dc:date>2019-01-07T19:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to retain the cell color after saving the data table into journal or new window</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/99285#M38792</link>
      <description>&lt;P&gt;Which version of JMP do you have?&amp;nbsp; Did you use this script or a modified script? If modified, please attach.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 19:41:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/99285#M38792</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-01-07T19:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to retain the cell color after saving the data table into journal or new window</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/104801#M38825</link>
      <description>Thanks.&lt;BR /&gt;My JMP version JMP14, (64bit); Didn't modify the script, run the exact script below:&lt;BR /&gt;Names Default To Here( 1 );&lt;BR /&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;BR /&gt;dt &amp;lt;&amp;lt; Color by Column( :age );&lt;BR /&gt;Wait( 0 );&lt;BR /&gt;&lt;BR /&gt;//This next command does not save the cell colors.&lt;BR /&gt;//dt &amp;lt;&amp;lt; Color Rows by Row State;&lt;BR /&gt;dt &amp;lt;&amp;lt; Clear column selection();&lt;BR /&gt;dt &amp;lt;&amp;lt; clear select;&lt;BR /&gt;&lt;BR /&gt;//get the unique colors&lt;BR /&gt;nr = N Row( dt );&lt;BR /&gt;//make a list the size of the table to get the row colors and locate rows of a given color&lt;BR /&gt;&lt;BR /&gt;_clr = As List( J( nr, 1, 0 ) );&lt;BR /&gt;&lt;BR /&gt;For( i = 1, i &amp;lt;= N Row( dt ), i++,&lt;BR /&gt;_clr[i] = Color To RGB( Color Of( Row State( i ) ) )&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;//creates a list of unique colors&lt;BR /&gt;clr_keys = Associative Array( _clr ) &amp;lt;&amp;lt; get keys;&lt;BR /&gt;&lt;BR /&gt;//for each color (j), locate which rows are assigned that color using Loc( _clr, ...)&lt;BR /&gt;For( j = 1, j &amp;lt;= N Items( clr_keys ), j++,&lt;BR /&gt;&lt;BR /&gt;idx = Loc( _clr, clr_keys[j] );&lt;BR /&gt;//Color the cells in rows idx and each coloumn&lt;BR /&gt;For( i = 1, i &amp;lt;= N Col( dt ), i++,&lt;BR /&gt;Column( dt, i ) &amp;lt;&amp;lt; color cells( RGB Color( clr_keys[j] ), idx )&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;//now journal the table&lt;BR /&gt;dt &amp;lt;&amp;lt; journal;</description>
      <pubDate>Tue, 08 Jan 2019 19:00:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-retain-the-cell-color-after-saving-the-data-table-into/m-p/104801#M38825</guid>
      <dc:creator>wu</dc:creator>
      <dc:date>2019-01-08T19:00:42Z</dc:date>
    </item>
  </channel>
</rss>

