I am still studing codesys system, I solved many trouble I had but I find always new trouble... Melius est abundare quam deficere π
Well, I explane the situation:
I created an array of type StrArr, a STRUCT with several data of different nature to create a custom datalogger with WSTRING,BOOL, DATE and TIME variables.
I am showing it, in the visu section, throughout a table, https://help.codesys.com/webapp/_visu_elem_table;product=core_visualization;version=3.5.17.0#element-property-columns
In the column 0, that points to the FlagAllarme variable of the STRUCT, I am tring to use the template option.
I would like to show a rectangle, in that column, that changes its color (red/green) on the base of a boolean variable conteined in the StrArr STRUCT.
I paste a bit of code to help the understaing ( I apoligeze for the italian comment).
This is the struct:
TYPE StrArr :STRUCT FlagAllarme : BOOL; DataDiAccesso : DATE ; OraDiAccesso : TIME; OperatoreLoggato : WSTRING; Evento : WSTRING;END_STRUCTEND_TYPE
The following is the PRG I call to write into the array:
Hi guys,
I am still studing codesys system, I solved many trouble I had but I find always new trouble...
Melius est abundare quam deficere π
Well, I explane the situation:
I created an array of type StrArr, a STRUCT with several data of different nature to create a custom datalogger with WSTRING,BOOL, DATE and TIME variables.
I am showing it, in the visu section, throughout a table, https://help.codesys.com/webapp/_visu_elem_table;product=core_visualization;version=3.5.17.0#element-property-columns
In the column 0, that points to the FlagAllarme variable of the STRUCT, I am tring to use the template option.
I would like to show a rectangle, in that column, that changes its color (red/green) on the base of a boolean variable conteined in the StrArr STRUCT.
I paste a bit of code to help the understaing ( I apoligeze for the italian comment).
This is the struct:
The following is the PRG I call to write into the array:
Now the trouble is when I put the "COLOR VARIABLE" in the visu secion I write the several line but no one of them works.
DataLogger.LogArr[].FlagAllame
DataLogger.LogArr[DataLogger.indice].FlagAllame
DataLogger.LogArr[DataLogger.indice].FlagAllame = 0/1
the compiler gives me always the same error:
C0007: Expression expected instead of ']'
If I put this:
(DataLogger.LogArr[DataLogger.indice].FlagAllame = 0/1)
The application runs but the colors doesn't switch.
Does someone know where the error is?
Many thanks,
Riccardo
Last edit: Riccardo 2021-12-22
by default the string value of struct member is put in the table field
via Text variable :: DataLogger.LogArr[INDEX].FlagAllame
just put this in the property Toggle color:
Hi Fless thanks for the reaply,
You are great!!!
I didn't find nothing about INDEX variable, but it works properly.
Many Thanks.
I wish you very good Celebrations.
Riccardo
Last edit: Riccardo 2021-12-23