- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Highlight cells based on matched column names
I have a script that colors the minimum values yellow for every Studentized column in a table. I want to also highlight values adjacent to these values in raw columns. For example, for Studentized Resid Rest Pulse, the cell adjacent to -2.321144119 in Rest Pulse column i.e. 44. How can I do this in jsl? Can regex or match be helpful? Thank you
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
)
);
I am looking for something like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Highlight cells based on matched column names
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Highlight cells based on matched column names
I may not be understanding your issue. If you want to color the cells adjecent to the min values found for the columns that contain "Studentized ....." then all you have to do is to do it. You have the list of column names......colNamesList, and you are looking through the columns. When you find a column that has "Studentized......" in it, you then find the name of the other column you want to color and the row that is the minimum value. So that means, you also know the cells that are adjecent to the cells you are going to color.....
column( Substr( colNameList[i], 19 ) ) << << color cells( Yellow, MinRows )
and if you add this right after the coloring of the "Studentized......" column, it will color the appropriate cell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Highlight cells based on matched column names
@txnelson Do you mean something like this?
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows ),
//column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
); column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
)
);
I made it to work. Thanks a lot for the guidance..
- « Previous
-
- 1
- 2
- Next »