DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto-sizing 2D Table in Report semi-programatically

I'm trying to have the number of columns in my 2D Table change with the number of groups that are loaded into the data portal.  Normally when I'm VBScripting, I use the GroupCount variable to accomplish this.  When I use the @@GroupCount@@ command in the Table Definition dialog box, I get an error that says "Cannot assign the value 12 to the integer variable.  Assignment:  <D2TABBEGIN=12>".  It would appear that the program understands the command and is finding the correct value, but it's just not able to assign it to the variable.  Is this not a valid use of the Table Definition dialog box, or is it a syntax error?

 

0 Kudos
Message 1 of 4
(3,442 Views)

Hi Steve,

 

The Table object is old and has some frustrating limitations, but one really nice thing about it that simplifies this task is that all the columns you want already exist, you just need to populate them.  So just start assigning column properties as many as you want:

Call GraphObjOpen("2DTable1")
  D2TabDataType(1) = "Channel"
  D2TabChnName(1)  = "[1]/Time"
  D2TabRelWidth(1) = 1
  D2TabDataType(2) = "Channel"
  D2TabChnName(2)  = "[1]/Speed"
  D2TabRelWidth(2) = 1
         :
  D2TabDataType(n) = "Channel"
  D2TabChnName(n)  = "[1]/[n]"
  D2TabRelWidth(n) = 1
Call GraphObjClose("2DTable1")

If you end up with too many columns, you can just set the D2TabDataType and D2TabChnName variables to the empty string for those columns, and they will disappear.  Set them, and those columns appear-- presto!

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 4
(3,431 Views)

That makes sense.  I have a question about this implementation though.  If I create a script to generate the report, and I save that report as a TDR file, does it just save the result from running the script the one time, or does it build all of the flexibility into the TDR file itself where I can load 3 files or 8 files and the Table will adjust as programmed in the script?

0 Kudos
Message 3 of 4
(3,422 Views)

Hi Steve,

 

DIAdem tables can auto-adjust their row count to match the number of values in Channels assigned to table columns.  I believe what you're asking for is that the table adjust its column count to match the number of Groups in the Data Portal.  If you want to show Channels as columns, say one Channel from each Group per column, then the simplest approach would be to save a Table with no columns configured to the TDR file, then load that TDR and define each column in a VBScript using the code I've already posted.

 

If on the other hand you want to show multiple Group properties in the rows, but still have one Group per column, then there are other options to embed this logic in the table object.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 4
(3,419 Views)