06-24-2022 07:06 AM
Hello all,
I'm working on diadem script, and I need some help with coloring some tabs. My table is 5x8, and in last column, I use a criteria who show "OK" or "NOK". Can you please help me do something like: when result is OK color background in green, when is NOK, color in red.
Thank you in advance.
06-27-2022 07:19 AM
Hi SkePsis,
For this you need a user command VBS for the event “OnDrawingCell”
The example “Using User Commands for Trend Displays in Tab” explains how this works.
Greetings
Walter
06-28-2022 03:41 AM
Thank you fir hint. I take a look, but I'm still learning about Diadem, for moment I didn't get the final result. I don't know how exactly example script run
06-29-2022 12:47 AM
Hi SkePsis,
I try to briefly explain the example.
In DIAdem supports several events for different situations. An event is a callback function which is called at certain situations. This function is a piece of VBS script code which is customizable. One of these events is “OnDrawingCell” which is called each time if a cell of a certain column in a REPORT table should be drawn.
In the main script “2D_Tab_UserFormat_1.vbs “ you find the “OnDrawingCell” commands to register the event function in the end of the script.
Report.Sheets("Sheet 1").Objects("2DTableTrend_Case1").Columns(4).Settings.OnDrawingCell = "TabTrendOnDrawingCell_Case1"
Report.Sheets("Sheet 1").Objects("2DTableTrend_Case2").Columns(4).Settings.OnDrawingCell = "TabTrendOnDrawingCell_Case2"
The VBS functions "TabTrendOnDrawingCell_Case1" and "TabTrendOnDrawingCell_Case2" are defined the user commands and defined in the file “UserCmdReport.vbs”. (More info about user command you find in the DIAdem help with key work “ScriptCMDAdd”). In these user commands is defined in which situations the background color is changed.
You can register a user command interactively or the VBS command “ScriptCmdAdd” – like the example does.
Greetings
Walter
06-29-2022 01:17 AM
Thank you for your time and support. I will try to adapt code for my application.
Have a great day!