DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting (color) individual cells in a column2 of table and the criteria is referred from column 3.==> Using Diadem scripts.

Solved!
Go to solution

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:

Durai26_1-1657795915299.png

Thanks,

Durai

0 Kudos
Message 1 of 11
(2,244 Views)

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.

 

santo_13_0-1657797048381.png

 

santo_13_1-1657797055455.png

 

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 11
(2,239 Views)

Hi Santhosh,

Thanks for your response.

I am actually trying to do it with Diadem scripts.

Do you have idea on that?

0 Kudos
Message 3 of 11
(2,229 Views)

Apologies, I did not look at the board I am replying in. Unfortunately, I am not familiar with DIAdem to offer any help.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 11
(2,218 Views)

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

0 Kudos
Message 5 of 11
(2,183 Views)

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

 

 

0 Kudos
Message 6 of 11
(2,178 Views)
Solution
Accepted by topic author Durai26

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

0 Kudos
Message 7 of 11
(2,172 Views)

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

0 Kudos
Message 8 of 11
(2,116 Views)

Hi Durai,

 

Please have a look ate the help for "2DTableDrawingCellContext". There you find for the row:

Context.Row  

Greetings

Walter

 

 

0 Kudos
Message 9 of 11
(2,097 Views)

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

 

 

0 Kudos
Message 10 of 11
(1,980 Views)