07-14-2022 05:54 AM - edited 07-14-2022 06:15 AM
Want to color the each cells in the column 2 with respect to criteria in column 3. If it satisfies the criteria, color it with green else color it with Red.
Sample expected output table:
Thanks,
Durai
Solved! Go to Solution.
07-14-2022 06:11 AM
Possible, you've to use the appropriate property node of the table control/indicator to set the BG Color individually by evaluating the values against the criteria. In the below image, I have demonstrated how to set colours for each cell, now you've to take care of evaluating the criteria to determine the colours.
07-14-2022 06:17 AM
Hi Santhosh,
Thanks for your response.
I am actually trying to do it with Diadem scripts.
Do you have idea on that?
07-14-2022 07:33 AM
Apologies, I did not look at the board I am replying in. Unfortunately, I am not familiar with DIAdem to offer any help.
07-18-2022 01:22 AM
Hi Durai,
with DIAdem we ship an example called "Creating an Excel File" which shows how to set a cell color in Excel. The relevant part looks like this:
set oCell = SetCellPair(oSheet, iRow, iCol, "Status: ", oGroups(2).Properties("Test~Status").Value)
if uCase(oCell.Value) = "FAIL" then
oCell.Interior.Color = iFailBGColor
oCell.Font.Color = iFailFontColor
else
oCell.Interior.Color = iPassBGColor
end if
Greetings
Walter
07-18-2022 02:10 AM
Hi Walter,
Thanks for your reply.
I don't want to create a table in excel. Is there a way to do it in Diadem itself without use any external application?
I want to create a table in Diadem report based on channel values. And color the individual cells in a column2 with respect to column3 in the same table.
Everything want to do it in Diadem report sheet using scripts.
regards,
Durai
07-18-2022 02:55 AM
Hi Durai,
Oops, I got something mixed up.
Yes, in a REPORT table you can change the background color of a cell with a user function. This user function can be defined for each column of the table. When drawing the table, the user function is then called for each cell value of the column so that you can adjust both the cell value and the cell parameters such as the cell color.
Here is an example:
“Using User Commands for Trend Displays in Tables”
Greetings
Walter
08-10-2022 01:20 AM
Thanks for the suggestion on user commands:
“Using User Commands for Trend Displays in Tables”
As per the example case, condition applies to a all the rows of column.
Is it possible to have individual condition for each row in a column?
sample:
Column 1: row 1: if value > 10, color by green
Column 1: row 2: if value > 5, color by red
Column 1: row 3: if value <> 1, color by red
Column 1: row 3: if value = 1, color by green
thanks,
Durai
08-15-2022 12:56 AM
Hi Durai,
Please have a look ate the help for "2DTableDrawingCellContext". There you find for the row:
Context.Row
Greetings
Walter
10-12-2022 06:28 AM
Is it possible to transfer variable from main script to user command?
User command:
if cell.value > X then
Cell.BackgroundColor.SetRGBColor(RGB(255, 0, 0))
end if
Value of X is needs to be transferred from main script [VBS script] to user command.
X = A + B
A and B are values from channel.
Regards,
Durai