Quote from Gustavo1973 on June 14, 2021, 7:17 pmQuiero mostrar el texto de una columna de determinado color dandole formato, pero el color va a depender del valor que esta en otra columna del mismo registro, ejemplo:
Columna 1 : Juan Manuel
Columna 2: 65
Lo muestro en el Card de la siguiente manera : Juan Manuel, 65 Años
Pero si la edad es mayor de 50 quiero mostrar todo el texto en rojo, incluyendo el nombre, no solo la edad, me explico
Lo mismo si la edad es menor a 50 mostrar todo el texto, incluyendo el nombre en Verde
MI pregunta es si se puede hacer eso en el format de Neotable de pasarle el valor de otra columna
Quiero mostrar el texto de una columna de determinado color dandole formato, pero el color va a depender del valor que esta en otra columna del mismo registro, ejemplo:
Columna 1 : Juan Manuel
Columna 2: 65
Lo muestro en el Card de la siguiente manera : Juan Manuel, 65 Años
Pero si la edad es mayor de 50 quiero mostrar todo el texto en rojo, incluyendo el nombre, no solo la edad, me explico
Lo mismo si la edad es menor a 50 mostrar todo el texto, incluyendo el nombre en Verde
MI pregunta es si se puede hacer eso en el format de Neotable de pasarle el valor de otra columna
Quote from Gaev on June 15, 2021, 3:27 am@gustavo1973:
But if the age is over 50 I want to show all the text in red, including the name, not just the age
The way to approach this is to have a subroutine for both the fields.
a) examining the value of age in the subroutine for the Age column is straight forward.
b) in the subroutine for the Name column, obtaining the value of the Age column in the same row is a bit tricky; but take a look at this forum post ...
https://visualneo.com/forum/topic/neotable-neotablesetcolumn-and-subroutine-to-format-the-data
... Rocco (@roccocogliano) appears to have found an undocumented feature i.e. multiple values are being passed to the subroutine; using the json object and the index (row) values passed to the subroutine, you can extract the value of Age in the current row.
@gustavo1973:
But if the age is over 50 I want to show all the text in red, including the name, not just the age
The way to approach this is to have a subroutine for both the fields.
a) examining the value of age in the subroutine for the Age column is straight forward.
b) in the subroutine for the Name column, obtaining the value of the Age column in the same row is a bit tricky; but take a look at this forum post ...
... Rocco (@roccocogliano) appears to have found an undocumented feature i.e. multiple values are being passed to the subroutine; using the json object and the index (row) values passed to the subroutine, you can extract the value of Age in the current row.

Quote from roccocogliano on June 15, 2021, 9:23 amIt's right. I solved it that way.
I had the exact same need as you: check the value of a field (in my case a battery and solar panel voltage value and similar values) and based on this value report the problem by coloring red (or green if that's all ok) a 'name' contained in another field on the same row.Rocco
It's right. I solved it that way.
I had the exact same need as you: check the value of a field (in my case a battery and solar panel voltage value and similar values) and based on this value report the problem by coloring red (or green if that's all ok) a 'name' contained in another field on the same row.
Rocco
Quote from Gustavo1973 on June 15, 2021, 6:35 pm@roccocogliano
@gaev
Gracias , por la respuesta
algun ejemplo basico de como funciona o hacerlo no tienes?,
Gracias , por la respuesta
algun ejemplo basico de como funciona o hacerlo no tienes?,

Quote from roccocogliano on June 15, 2021, 7:43 pmHi @gustavo1973 in attached example (original neoTableTutorialPart1 example modified) I added a subroutine called "fmtFirstName" where there is the use of what I said. It's visible in page titled "Controlled view". The column "First Name" is coloured with red using "Age" column value.
I hope it will be useful to you
Rocco
Hi @gustavo1973 in attached example (original neoTableTutorialPart1 example modified) I added a subroutine called "fmtFirstName" where there is the use of what I said. It's visible in page titled "Controlled view". The column "First Name" is coloured with red using "Age" column value.
I hope it will be useful to you
Rocco
Quote from Gustavo1973 on August 19, 2021, 7:49 pm@roccocogliano
@gaev
Hola, perdon la demora
estoy mirando tu ejemplo y hay cosas que no logro comprender, no logro hacerlo funcionar
A la subrutina se le pasan 3 valores por lo que veo, el objeto que contiene todos los datos cargados, el identificador "idx" del cual no veo donde se hace la definicion del mismo en el ejemplo, y se le pasa el valor que contiene ese campo en particular para darle formato. es esto correcto?
No veo donde se aplica al otro campo el color, en tu ejemplo la subrutina lleva al nombre para darle formato, pero antes toma el valor del campo "Age"
Hola, perdon la demora
estoy mirando tu ejemplo y hay cosas que no logro comprender, no logro hacerlo funcionar
A la subrutina se le pasan 3 valores por lo que veo, el objeto que contiene todos los datos cargados, el identificador "idx" del cual no veo donde se hace la definicion del mismo en el ejemplo, y se le pasa el valor que contiene ese campo en particular para darle formato. es esto correcto?
No veo donde se aplica al otro campo el color, en tu ejemplo la subrutina lleva al nombre para darle formato, pero antes toma el valor del campo "Age"
Quote from Gaev on August 19, 2021, 11:26 pm@gustavo1973
I do not see where the color is applied to the other field, in your example the subroutine takes the name to format it, but before it takes the value of the field "Age"
I took a look at the (modified) neoTableTutorialPart1 uploaded by @roccocogliano ... I noticed that he has a subroutine named fmtFirstName ... but it is not referenced in the Table definition ... try and change the column definition for "First Name" to include this subroutine, like so ...
neoTableSetColumn "SubroutinesContainer" 2 "name" "First Name" "" false false true "fmtFirstName"... it will show the First Name in red color for those rows where Age is greater than 60
It invokes the neoTableGetData command to obtain the value of the Age filed for the current row (whose value is passed in the third parameter [idx].
The color is set in the style parameter within the < span > element returned from the subroutine.
I do not see where the color is applied to the other field, in your example the subroutine takes the name to format it, but before it takes the value of the field "Age"
I took a look at the (modified) neoTableTutorialPart1 uploaded by @roccocogliano ... I noticed that he has a subroutine named fmtFirstName ... but it is not referenced in the Table definition ... try and change the column definition for "First Name" to include this subroutine, like so ...
neoTableSetColumn "SubroutinesContainer" 2 "name" "First Name" "" false false true "fmtFirstName"
... it will show the First Name in red color for those rows where Age is greater than 60
It invokes the neoTableGetData command to obtain the value of the Age filed for the current row (whose value is passed in the third parameter [idx].
The color is set in the style parameter within the < span > element returned from the subroutine.

Quote from roccocogliano on August 20, 2021, 9:40 am@gaev
@gustavo1973
the function is just what @gaev says and is used in the "Load data" button of the "Views" page
the function is just what @gaev says and is used in the "Load data" button of the "Views" page
Uploaded files:Quote from Gaev on August 20, 2021, 3:13 pm@roccocogliano
is used in the "Load data" button of the "Views" page
My apologies, I was looking at the Subroutines page
@gustavo1973 - does this answer your question ?
is used in the "Load data" button of the "Views" page
My apologies, I was looking at the Subroutines page
@gustavo1973 - does this answer your question ?