Resaltar celdas en función de los nombres de columna coincidentesTengo un script que colorea los valores mínimos de amarillo para cada columna estudentizada en una tabla. También quiero resaltar los valores adyacentes a estos valores en columnas sin procesar. Por ejemplo, para Pulso de descanso de residencia estudentizada, la celda adyacente a -2.321144119 en la columna Pulso de descanso, es decir, 44. ¿Cómo puedo hacer esto en jsl? ¿Pueden ser útiles las expresiones regulares o las coincidencias? Gracias
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);
)
);
Estoy buscando algo como esto:

Re: Resaltar celdas basadas en nombres de columna coincidentes@Jeff_Perkinson Hola Jeff, ya he resuelto la parte de la subcadena. ¡Gracias!Re: Resaltar celdas basadas en nombres de columna coincidentes@txnelson ¿Te refieres a algo como esto?
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 )
);<BR /> column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
)
);
Lo hice para trabajar. muchas gracias por la orientacion..
Re: Resaltar celdas basadas en nombres de columna coincidentesPuede que no esté entendiendo tu problema.Si desea colorear las celdas adyacentes a los valores mínimos encontrados para las columnas que contienen "Studentized...", todo lo que tiene que hacer es hacerlo.Tiene la lista de nombres de columna... colNamesList, y está mirando a través de las columnas.Cuando encuentre una columna que tenga "Estudiante...", encontrará el nombre de la otra columna que desea colorear y la fila que tiene el valor mínimo.Eso significa que también conoces las celdas que son adyacentes a las celdas que vas a colorear...
column( Substr( colNameList[i], 19 ) ) << << color cells( Yellow, MinRows )<BR />
y si agrega esto justo después de colorear la columna "Studentized...", coloreará la celda apropiada
Re: Resaltar celdas basadas en nombres de columna coincidentesEs el substr() función lo que te estás perdiendo?
resid_colname="Studentized Resid Rest Pulse";
//There are 19 characters in "Studentized Resid "
orig_colname = substr(resid_colname, 19);
show(orig_colname);
/*:
orig_colname = "Rest Pulse";
Re: Resaltar celdas basadas en nombres de columna coincidentes@txnelson Hola Jim, lo siento si me estoy perdiendo algo aquí. También quería resaltar las columnas crudas adyacentes para cada columna estudentizada. No puedo hacer que esto funcione.
Re: Resaltar celdas basadas en nombres de columna coincidentesAquí hay una simple reelaboración de su guión.Funciona con sus datos de muestra y debería funcionar con tantas columnas como tenga en la tabla de datos.
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 )
);
// Output the requested values
Show( Substr( colNameList[i], 19 ), Cols[MinRows[1]] );
);
);
Re: Resaltar celdas basadas en nombres de columna coincidentesTodavía no he podido averiguar cómo puedo resolver este problema. Revisé otras preguntas y la guía de secuencias de comandos para llegar a mi secuencia de comandos más reciente.
Aquí está mi guión más reciente:
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);
//show(Loc())
MinValue = Col Min(Cols);
ColValue = As List(Cols << Get Values);
show(Loc(ColValue,MinValue));
show(substr(col[i], 19,100));
)
);
Realmente agradecería si alguien me puede mostrar cómo puedo usar el método Substring para hacer coincidir las columnas. Gracias de antemano.
Re: Resaltar celdas basadas en nombres de columna coincidentesEso suena como un enfoque razonable.
Re: Resaltar celdas basadas en nombres de columna coincidentesTodas las columnas sin procesar que tienen/coinciden con columnas estudentizadas deben resaltarse. Estaba mirando la guía de escritura y he estado tratando de trabajar con Regex Match, así como con la subcadena para extraer los nombres de las columnas sin el "Residente Estudiantil". También mantengo una lista de números de fila de columnas resaltadas aquí, con la esperanza de que me ayude a lograr lo que quiero. Cualquier mejor enfoque será muy apreciado.@txnelson
Re: Resaltar celdas basadas en nombres de columna coincidentes¿Cómo imagina la entrada de qué columnas deben procesarse?
¿Ha leído la Guía de secuencias de comandos?Hay muchos ejemplos en el libro que te darán ideas.
Ayuda==>Libros==>Guía de secuencias de comandos
Re: Resaltar celdas basadas en nombres de columna coincidentes@pmroz gracias por la respuesta, sin embargo, estoy buscando una solución más dinámica a ese problema ya que podría tener
a) Muchas columnas
b) Diferentes nombres de columna en el futuro.
¿Hay alguna función JMP que pueda hacer la tarea? Gracias
Re: Resaltar celdas basadas en nombres de columna coincidentesAquí hay una forma con nombres de columna codificados:
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 );
:Rest Pulse << color cells( Yellow, Min );
:Run Pulse << color cells( Yellow, Min );
:Max Pulse << color cells( Yellow, Min );
);
);