<?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: Selecting Cells based on color in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/341025#M58942</link>
    <description>&lt;P&gt;As an alternative to the approach of&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;,&amp;nbsp;it's maybe worth going back a step to think about how the table was made. The attached version of the 'Penta' sample data was made exploiting the 'Add To Missing Value Codes' option:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-12-11 at 12.03.00.png" style="width: 857px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28852iDAC388E6DAD57112/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-12-11 at 12.03.00.png" alt="Screenshot 2020-12-11 at 12.03.00.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can then use code like this, which has the added benefit that you are not actually changing the data values in the table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

dt = DataTable("myPenta");

// Pick a column
myCol = Column(dt, "L4");

// Get the values deemed to be outliers
mvc = myCol &amp;lt;&amp;lt; getProperty("Missing Value Codes");

// Delete this column property, else the subsequent 'getValues()' will return '.'
// rather than the cell value in the case of outliers
myCol &amp;lt;&amp;lt; deleteProperty("Missing Value Codes");

// Get all the values
vals = myCol &amp;lt;&amp;lt; getValues;

// Build the list to go into the 'Value Label' property
valList = {};
for(v=1, v&amp;lt;=NItems(vals), v++,
	if(Contains(mvc, vals[v]),
		// We have an outlier . . .
		InsertInto(valList, EvalExpr(Expr(vals[v]) = "Outlier")),
		// Else the point is 'Normal'
		InsertInto(valList, EvalExpr(Expr(vals[v]) = "Normal"))
		)
	);

// Add the 'Value Label' property
myCol &amp;lt;&amp;lt; valueLabels(valList);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 11 Dec 2020 12:59:30 GMT</pubDate>
    <dc:creator>ian_jmp</dc:creator>
    <dc:date>2020-12-11T12:59:30Z</dc:date>
    <item>
      <title>Selecting Cells based on color</title>
      <link>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/340919#M58932</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;After running the outlier analysis tool in JMP, I color coded the cells that contained outliers. How can I select all these cells and replace them with the name, "outlier"? The next step, would be to name all the other cells "normal".&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Let me know if this is feasible. A snapshot of the datasheet in appended in this post.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeDereviankin_0-1607644587261.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28847iE4BAF074B6A57F3B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeDereviankin_0-1607644587261.png" alt="MikeDereviankin_0-1607644587261.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:00:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/340919#M58932</guid>
      <dc:creator>MikeDereviankin</dc:creator>
      <dc:date>2023-06-09T22:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Cells based on color</title>
      <link>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/340977#M58935</link>
      <description>&lt;P&gt;I am not aware of an easy way to get the cell color from a cell, let alone, select all of the rows for cells in a column, that has a specific color in it.&amp;nbsp; However, the way that I do that, is to extract the script for the column of interest, and then to search for the Color Cells area of the script, and parse out the rows.&lt;/P&gt;
&lt;P&gt;I have attached a sample data table.&amp;nbsp; The data table was produced using the Outlier Analysis Tool. When the below script is run on that data table, it will find the cells in the column SS-E that have been colored light red(color 35 to JMP), and change the value for those cells to "outlier" and then change all of the other cells to "normal".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sc1.PNG" style="width: 787px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28848i459133851C82C4C3/image-size/large?v=v2&amp;amp;px=999" role="button" title="sc1.PNG" alt="sc1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please note, to change the cells to either "outlier" or "normal" the column had to be changed to a character column, and all of the original data are replaced.&lt;/P&gt;
&lt;P&gt;Here is the script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();


x=char(:name("ss-e")&amp;lt;&amp;lt;get script);
x=substr(x,contains(x,"Color Cells"));

x=substr(x,contains(x,"{35, ")+5);
x=substr(x,1,contains(x,"}"));


myMatrix =matrix( parse(x));

dt:Name("ss-e") &amp;lt;&amp;lt; data type(character);

dt &amp;lt;&amp;lt; select rows(myMatrix);

dt:Name("ss-e")[dt&amp;lt;&amp;lt;get selected rows] = "outlier";
dt &amp;lt;&amp;lt; invert row selection;
dt:Name("ss-e")[dt&amp;lt;&amp;lt;get selected rows] = "normal";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Dec 2020 03:12:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/340977#M58935</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-11T03:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Cells based on color</title>
      <link>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/341025#M58942</link>
      <description>&lt;P&gt;As an alternative to the approach of&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;,&amp;nbsp;it's maybe worth going back a step to think about how the table was made. The attached version of the 'Penta' sample data was made exploiting the 'Add To Missing Value Codes' option:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-12-11 at 12.03.00.png" style="width: 857px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28852iDAC388E6DAD57112/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-12-11 at 12.03.00.png" alt="Screenshot 2020-12-11 at 12.03.00.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can then use code like this, which has the added benefit that you are not actually changing the data values in the table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

dt = DataTable("myPenta");

// Pick a column
myCol = Column(dt, "L4");

// Get the values deemed to be outliers
mvc = myCol &amp;lt;&amp;lt; getProperty("Missing Value Codes");

// Delete this column property, else the subsequent 'getValues()' will return '.'
// rather than the cell value in the case of outliers
myCol &amp;lt;&amp;lt; deleteProperty("Missing Value Codes");

// Get all the values
vals = myCol &amp;lt;&amp;lt; getValues;

// Build the list to go into the 'Value Label' property
valList = {};
for(v=1, v&amp;lt;=NItems(vals), v++,
	if(Contains(mvc, vals[v]),
		// We have an outlier . . .
		InsertInto(valList, EvalExpr(Expr(vals[v]) = "Outlier")),
		// Else the point is 'Normal'
		InsertInto(valList, EvalExpr(Expr(vals[v]) = "Normal"))
		)
	);

// Add the 'Value Label' property
myCol &amp;lt;&amp;lt; valueLabels(valList);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Dec 2020 12:59:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/341025#M58942</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2020-12-11T12:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Cells based on color</title>
      <link>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/341111#M58950</link>
      <description>&lt;P&gt;This works great!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What is the syntax to iteratively loop through each column name instead of appending just one column name? How do you restrict this loop to only look through columns 1-10 for example?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Appreciate the scripting help, this is great stuff.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 14:30:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/341111#M58950</guid>
      <dc:creator>MikeDereviankin</dc:creator>
      <dc:date>2020-12-11T14:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Cells based on color</title>
      <link>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/774482#M95630</link>
      <description>&lt;P&gt;One can go via the script behind the columns to get all colored cells:&lt;BR /&gt;&lt;LI-MESSAGE title="How to get the row number of colored cells in a column and assign it a tag (say &amp;amp;quot;1&amp;amp;quot;) in a newly created column?" uid="749264" url="https://community.jmp.com/t5/Discussions/How-to-get-the-row-number-of-colored-cells-in-a-column-and/m-p/749264#U749264" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 05:05:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Selecting-Cells-based-on-color/m-p/774482#M95630</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-07-22T05:05:55Z</dc:date>
    </item>
  </channel>
</rss>

