Subscribe Bookmark RSS Feed

How to extract the value color column property and store in a list?

shaira

Contributor

Joined:

May 4, 2017

Hi,

I want to get the color assigned to a specific cell, assuming that the cell column has "value color" property.

Here is the copy of my script that was applied to Big Class.jmp. I added value color property to "sex" column.

//Get the grouping column and store in a list
Summarize( A = by( :sex ) );
B = :sex << get property( value ordering );
If( Is Empty( B ),
	GroupList = A,
	GroupList = B
);
Show( GroupList );

//get the value color ordering property
GroupColor=:sex << get property( value colors );
Show(GroupColor);

The output is as follows:

GroupList = {"F", "M"};
GroupColor = {"F" = 19, "M" = 21};

However, I want the output for the GroupColor to be like this:

GroupColor = {19,  21};

Is this possible?Thanks,
Shaira

2 ACCEPTED SOLUTIONS

Accepted Solutions
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
:sex << Set Property( "Value Colors", {"F" = -13647958, "M" = -4222675} );
groupColor = :sex << get property( value colors );
Show(groupColor);

for(i=1, i<=NItems(groupColor), i++,
	groupColor[i] = Arg(groupColor[i], 2);
);
Show(groupColor);
txnelson

Super User

Joined:

Jun 22, 2012

Solution

This will work

For( i = 1, i <= N Items( GroupColor ), i++,
	GroupColor[i] = Num( Word( 3, Char( GroupColor[i] ) ) )
);
Jim
4 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
:sex << Set Property( "Value Colors", {"F" = -13647958, "M" = -4222675} );
groupColor = :sex << get property( value colors );
Show(groupColor);

for(i=1, i<=NItems(groupColor), i++,
	groupColor[i] = Arg(groupColor[i], 2);
);
Show(groupColor);
shaira

Contributor

Joined:

May 4, 2017

Thanks! This works. :)
txnelson

Super User

Joined:

Jun 22, 2012

Solution

This will work

For( i = 1, i <= N Items( GroupColor ), i++,
	GroupColor[i] = Num( Word( 3, Char( GroupColor[i] ) ) )
);
Jim
shaira

Contributor

Joined:

May 4, 2017

Thanks! This also works. :)