<?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: Creation of the &amp;quot;Value Colors&amp;quot; property in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52981#M29982</link>
    <description>&lt;P&gt;The ExprList is not being constructed properly.&amp;nbsp; You need to have the literal values in the list, not calculated values.&amp;nbsp; Here is one way to accomplish that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Start of script;
Names Default To Here( 1 );
Clear Log();

dt = Open( "$SAMPLE_DATA/Big Class.JMP" );

Summarize( NamesList = by( :Name ) );
Show( NamesList );

// Build the ExprLIst to be exactly what the Value Colors
// list needs to be
ExprList = {};
For( i = 1, i &amp;lt;= N Items( NamesList ), i++,
	Eval(
		Substitute(
				Expr(
					Insert Into( ExprList, Expr( __Names__ = __color__ ) )
				),
			Expr( __Names__ ), NamesList[i],
			Expr( __color__ ), 2 + i
		)
	)
);

Show( ExprList );

// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.
:Name &amp;lt;&amp;lt; set property( "Value Colors", ExprList );

// The Value Colors property is correct;
Show( :Name &amp;lt;&amp;lt; get property( "Value Colors" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 10 Mar 2018 14:29:51 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-03-10T14:29:51Z</dc:date>
    <item>
      <title>Creation of the "Value Colors" property</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52898#M29948</link>
      <description>&lt;P&gt;How can I script the creation of a set of value colors for a data table column without having to specify what they actually are?&lt;/P&gt;&lt;P&gt;I'm asking because I have an application that is expecting to&amp;nbsp;find a "Value Colors" property associated with a selected column, and&amp;nbsp;will crash if that property doesn't exist. I don't want to have to define the actual colors themselves because they're irrelevant: I just need there to &lt;EM&gt;be&lt;/EM&gt; a Value Colors property.&lt;/P&gt;&lt;P&gt;I can do this very easily interactively by just right-clicking on the column in question, and selecting "Value Colors" from the list of properties, whereupon a default set is defined automatically for me. It's essentially this operation therefore that I need to script - and I'm guessing that the solution will be a single line of code, but I'm afraid I just can't see it. Can anyone help?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 14:58:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52898#M29948</guid>
      <dc:creator>DMR</dc:creator>
      <dc:date>2018-03-09T14:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of the "Value Colors" property</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52927#M29954</link>
      <description>&lt;P&gt;You can use JSL like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;column(dt, "Column 1") &amp;lt;&amp;lt; Set Property( "Value Colors", {2 = 45, 3 = 46, 4 = 47} );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The way to figure this out is to&lt;/P&gt;
&lt;P&gt;1. Create a small dummy table with a single numeric column&lt;/P&gt;
&lt;P&gt;2. Manually add the &lt;STRONG&gt;Value Colors&lt;/STRONG&gt; attribute&lt;/P&gt;
&lt;P&gt;3. Click the little red triangle next to the table name and select &lt;STRONG&gt;Copy Table Script&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;4. Open up a JSL script window and paste the resulting code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will look something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Untitled 14",
	Add Rows( 3 ),
	New Column( "Column 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Value Colors", {1 = -13977687, 2 = -3780931, 3 = -4222943} ),
		Set Selected,
		Set Values( [1, 2, 3] )
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 16:31:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52927#M29954</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-03-09T16:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of the "Value Colors" property</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52928#M29955</link>
      <description>&lt;P&gt;I was able to put a BS value colors property into a column doing this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Column 1 &amp;lt;&amp;lt; Set Property("Value Colors",{});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Seems like the application really ought to be updated to work more robustly though.&amp;nbsp; Strange requirement.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 16:33:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52928#M29955</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-03-09T16:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of the "Value Colors" property</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52976#M29978</link>
      <description>&lt;P&gt;Many thanks both Peter and CWillden for your help; unfortunately I'm still not there - but I've been able to crystallize the problem a little.&amp;nbsp; The attached script shows where I've got to now: if I can resolve the final difficulty regarding how to create a list of expressions that I can then&amp;nbsp;feed into the Value Colors property,&amp;nbsp;I should be able to get what I need:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Start of script;

clear log();

dt = Open( "$SAMPLE_DATA/Big Class.JMP" );

// The Value Colors property of the first column is initially empty;

show(:Name &amp;lt;&amp;lt; get property("Value Colors"));

/*
	I now want to create a Value Colors property for this column,
	but I'd prefer to do it without having to identify all the names
	beforehand if possible.  Try CWillden's suggestion...
*/

:Name &amp;lt;&amp;lt; set property("Value Colors", {});

// If I now try to color the cells by value, it DOES actually seem to have worked;

:Name &amp;lt;&amp;lt; color cell by value(1);

// But the Value Colors property STILL only contains an empty list;

show(:Name &amp;lt;&amp;lt; get property("Value Colors"));

/*
	Unfortunately I do actually need a populated list - and it looks like I can't do it
	without extracting the names explicity.  Here's one way I think I COULD do it...
*/

summarize(NamesList=by(:Name));
show(NamesList);

/*
	I now need to put those names into a list of expressions that follow the syntax
	shown in PMRoz's post, and use that list to define the Value Colors property I need.

	This next bit is WRONG - but you can see what I'm trying to do here.
	What I need inside ExprList is a list of names, each coupled with an integer from 3 onwards
	(to get some colors starting at red).  I suspect I should probably be using the Substitute
	and/or Eval Expr functions at this point, but I can't get the correct syntax.
*/

ExprList = {};
for(i=1, i&amp;lt;=nItems(NamesList), i++,
	insert into(ExprList, expr(NamesList[i] = (2+i)))
	);

show(ExprList);

// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.

:Name &amp;lt;&amp;lt; set property("Value Colors", ExprList);

// End of script.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Mar 2018 11:51:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52976#M29978</guid>
      <dc:creator>DMR</dc:creator>
      <dc:date>2018-03-10T11:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of the "Value Colors" property</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52981#M29982</link>
      <description>&lt;P&gt;The ExprList is not being constructed properly.&amp;nbsp; You need to have the literal values in the list, not calculated values.&amp;nbsp; Here is one way to accomplish that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Start of script;
Names Default To Here( 1 );
Clear Log();

dt = Open( "$SAMPLE_DATA/Big Class.JMP" );

Summarize( NamesList = by( :Name ) );
Show( NamesList );

// Build the ExprLIst to be exactly what the Value Colors
// list needs to be
ExprList = {};
For( i = 1, i &amp;lt;= N Items( NamesList ), i++,
	Eval(
		Substitute(
				Expr(
					Insert Into( ExprList, Expr( __Names__ = __color__ ) )
				),
			Expr( __Names__ ), NamesList[i],
			Expr( __color__ ), 2 + i
		)
	)
);

Show( ExprList );

// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.
:Name &amp;lt;&amp;lt; set property( "Value Colors", ExprList );

// The Value Colors property is correct;
Show( :Name &amp;lt;&amp;lt; get property( "Value Colors" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Mar 2018 14:29:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52981#M29982</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-03-10T14:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of the "Value Colors" property</title>
      <link>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52985#M29985</link>
      <description>&lt;P&gt;Perfect!&amp;nbsp; Always better to ask the experts than try to get &lt;EM&gt;that&lt;/EM&gt; sort of construction right :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks, Jim!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 15:01:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creation-of-the-quot-Value-Colors-quot-property/m-p/52985#M29985</guid>
      <dc:creator>DMR</dc:creator>
      <dc:date>2018-03-10T15:01:23Z</dc:date>
    </item>
  </channel>
</rss>

