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.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

D2TabNumFormat Report Table

Solved!
Go to solution

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)@@"

 

 

 

0 Kudos
Message 1 of 6
(3,697 Views)

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

0 Kudos
Message 2 of 6
(3,686 Views)

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.

0 Kudos
Message 3 of 6
(3,673 Views)
Solution
Accepted by topic author Ayane

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

Download All
Message 4 of 6
(3,661 Views)

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

0 Kudos
Message 5 of 6
(3,629 Views)

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

 

Message 6 of 6
(3,616 Views)