From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-18-2016 02:57 PM
Hello everyone !
I have some trouble to use D2TabNumFormat on a report.
Is it possible to dynamically color a cell value, using a channel property (minimum/maximum), with the D2TabNumFormat function?
Knowing that I already use a user command that need minimum and maximum properties and cell values of the channel, and the format.
Here's how I'd like to use the function:
D2TabNumFormat(i) = "@@TableCellFormat(CFV,""d.dd"",Data.Root.ChannelGroups(GrpIdx).Channels(i).Properties(""minimum"").Value,Data.Root.ChannelGroups(GrpIdx).Channels(i).Properties(""maximum"").Value)@@"
Solved! Go to Solution.
07-19-2016 12:38 AM
Hi Ayane,
Yes, it is possible to color the content of a table column dynamically.You can use the "OnDrawingCell" event for it. This give the ability to individually format a certain table cell just before it is drawn. Please have a look at the example "Using User Commands for Trend Displays in Tables".
Greetings
Walter
07-19-2016 11:55 AM
Thank you for your answer Walter.
I know it is possible with OnDrawingCell, but is it possible to use the D2TabNumFormat function instead? I am forced to use this function with the way I generate the report.
07-20-2016 03:42 AM
Hi Ayane,
In general it is possible but this is not the current way to customize the table. You must define a user function which contains the manipulation, register it and modify the table in report. I have attached an example (old.zip) for it . But once again, this is not what we recommend for customizing REPORT. Since 2014 we have a new script interface for REPORT. I also attache an example (new.zip) for the same modification with the new syntax.
Greetings
Walter
07-21-2016 03:10 PM
Thank you for your example!
So I changed my way of generating report.
I just have one last question, how to apply the user command to all columns. I always have to inform the value of the column where I want to apply the user command?
For example, instead of applying just the fourth column, how to do it dynamically to all the columns of my table?
dMax = Data.GetChannel (Content.Table.Columns (4) .Channel.Reference) .Maximum
dMin = Data.GetChannel (Content.Table.Columns (4) .Channel.Reference) .Minimum
07-22-2016 12:58 AM
To answer your request, I modified the example script. In the initial script you see now a loop over all table columns to initialize them. If you always have the same settings for the columns, you don’t need the select case statement.
In the event script is called each time a table cell is drawn. For the cell which is currently drawn I calculate min and max values of the channel which is connected with the column.
dMax = Data.GetChannel(oContext.Table.Columns(iCol).Channel.Reference).Maximum
dMin = Data.GetChannel(oContext.Table.Columns(iCol).Channel.Reference).Minimum
With the select case statement, I can differentiate between vary situations. But this depends on the type of problem.
I hope this is what you're looking for.
Greetings
Walter