01-23-2018 09:20 AM
LLX,
Thanks for taking the time to send your code. I did get it working somewhat but it seems like the user command can't consistently read the cell values to determine what color to make the cell. DIAdem 2017 claims most of the functions are obsolete and not even available anymore so possibly this is the problem. Still it is truly odd that such a powerful analysis and reporting tool such as DIAdem lacks the ability to color test results in the way users expect. I'm a big fan of DIAdem but this is a bad one.
To leave on a brighter note, your code is very clever to accommodate a large amount of data and creates as many pages as necessary to display it. Thank you again.
Dave
01-23-2018 09:27 AM
Dave, I used Diadem 15 and 2017 before , and now I am using 2014. So far, it is the most stable version.
01-23-2018 09:47 AM
llx,
Yes I just switched to the 2015 version and I am getting better results. In 2017, the "Graph.." and "Pic.." functions are not highlighted and the help system does not recognize them.
Did you have trouble with version 2017? Looks like they removed a whole category of functions in favor of the object paradigm.
Dave
01-31-2018 12:34 PM - edited 01-31-2018 12:35 PM
Hi Guys,
It is certainly true that conditionally coloring individual table cells is quite difficult, up to and including DIAdem 2017. Traditionally, you had to declare a UserCommand that knows how to pass the CFV, D2TabRow, D2TabCol, etc. variables in and out, and then you had to invoke that UserCommand with an @@ expression embedded within the table configuration. Things are a bit easier now with the Report object, though you still have to define the UserCommand you configure to fire during each table redraw:
Report.Events.Drawing.OnTable2DColumn = "MyUserCommandForTableCellColoring"
That said, I would fully expect all your previous GraphObj... and Pic... code to still work in DIAdem 2017, even though they are no longer color highlighted in the SCRIPT editor and no longer appear in the DIAdem Help system. Now, with DIAdem 2018 I hear these commands will no longer function at all, so it is time to root them out, if you want to keep upgrading your DIAdem.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
09-21-2020 08:47 AM
Hello Brad,
I´m using DIAdem 2018 and I´m facing the same problem: I want to colorize each cell individually.
So here is my test-script, which creates a table, adds a channel and links the user-Command. The user-command should colorize values < 0.04 green, else red.
'Clear Report
report.ActiveSheet.Objects.RemoveAll
'Variables
dim oTable, oCol
'Objects
Set oTable = report.ActiveSheet.Objects.Add(eReportObject2DTable,"")
Set oCol = oTable.Columns.Add(e2DTableColumnChannel)
'Add Channel in table
oCol.Channel.Reference = Data.Root.ChannelGroups(1).Channels(1).GetReference(eRefTypeIndexIndex)
'Add UserCommand
oTable.Columns(1).Settings.OnDrawingCell = "MyOnDrawingCell"
'Refresh
report.Refresh
MyOnDrawingCell:
Sub MyOnDrawingCell(Context, Cell)
'Criteria: Values below 0.04: green
if Cell.Value < 0.04 then
Cell.Font.Color.ColorIndex = eColorIndexGreen
'red
else
Cell.Font.Color.ColorIndex = eColorIndexRed
end if
end sub
However the cells will not be colorized individually, but they get the color of the last Value (in my example the last value is > 0.04 [red] so the whole column is red (s. attachement).
Is there any way to get this done in version 2018?
Thanks in advanced