03-22-2012 10:57 AM
Hi klifoufou,
I see that you have a VBScript which creates 8 empty channels in the Data Portal in a new Group and then completely creates a Table from scratch that displays the values of those 8 channels, one for each column. The problem is that the 8 channels have no channel values. You need to copy the properties you want to display in the table from the source channels into the values of these new 8 channels. I offered to help with this earlier, but I can't give you working code without your starting data set. The command to do the value assigning is ChV(row, channel), and the command to read the source channel property value is ChnPropValGet(channel, propname). So it looks something like this, only in a loop to create the 8 columnsx100 rows in the multipage table.
ChV(i, Ch1) = ChnPropValGet(SourceCh, "minimum")
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-23-2012 04:09 AM
Hello,
You will find the file of my tests, you will find the .dat to load and the both of the macros that i created.
I created a macro for the title of the columns which called "table_test2 .vbs" and after I saved the obtain graph « Table_test2.TDR » and I called in the macro of column « 8 colonnes .vbs »
I know that it's not a solution because in this case the number of lines is always the same, and in my case I have to do a macro which depend of the number of channels
(exemple: for 10 channels I have to do a table with 10 channels not more and not less)
Furthermore, I have the problem of the size of datas which is not enough big when I add D2TabVariable(2)="@ChnComment(d2tabrow)@" for the second column, and of the maximum time and the minimum time too.
I hope that you understand my problems and you can help me.
Thanks a lot
03-23-2012 01:07 PM
Hi klifoufou,
I altered your 8 colonne script to build a multipage table I think you will like:
OPTION EXPLICIT Dim i, iMax, voie, Filt, NumTableRows, FirstRow, LastRow For voie = 1 to ChnNoMax Select Case UCase(Right(CN(voie), 1)) case "0" : Filt = "Unfiltered" case "P" : Filt = "Native data" case "A" : Filt = "CFC1000" case "B" : Filt = "CFC600" case "C" : Filt = "CFC180" case "D" : Filt = "CFC60" case "X" : Filt = "Without Filter" end select Call ChnPropValSet(voie, "Filter", Filt) next ' voie NumTableRows = 20 iMax = ChnNoMax/NumTableRows IF CLng(iMax) < CDbl(iMax) THEN iMax = CLng(iMax + 1) Call PicDelete() 'clear DIAdem Graph Call WndShow("REPORT") FOR i = 1 TO iMax IF i = 1 THEN Call GraphSheetInfos() Call GraphSheetNGet(GraphSheetCount) Call GraphSheetRename(GraphSheetName, "Table " & i) ELSE Call GraphSheetNew("Table " & i) END IF FirstRow = 1 + (i-1)*NumTableRows LastRow = i*NumTableRows IF LastRow > ChnNoMax THEN LastRow = ChnNoMax Call GraphSheetRefSet("Table " & i) Call CreateTable("PropTable", FirstRow, LastRow, 1) Call PicUpdate NEXT ' i Sub CreateTable(TableName, RowStart, RowStop, RowStep) Call GraphObjNew("2D-Table", TableName) Call GRAPHObjOpen(TableName) D2TabBegin = RowStart D2TabEnd = RowStop D2TabNoDist = RowStep D2TabAutoScalTyp = "fixed" D2TabTop = 1 D2TabBottom = 1 D2TabLeft = 1 D2TabRight = 1 D2TabXDoubleLine = 1 D2TabYDoubleLine = 1 D2TabTxtAutoScal = 1 D2TabGrid(1) = 1 D2TabGrid(2) = 1 D2TabNumAutoScal = 0 '''************************Nom**************************** D2TabHeaderTxt(1,1)= "Nom" D2TabTxtType(1) = "column defined headline" D2TabDataType(1)="Expression" D2TabVariable(1)="@ChnName(D2TabBegin-1+d2tabrow)@" D2TabRelWidth(1)= 1.0 D2TabNumSize(1) = 2.35 '************************ Description *******' D2TabHeaderTxt(2,1)= "Description" D2TabTxtType(2) = "column defined headline" D2TabDataType(2)="Expression" D2TabVariable(2)="@ChnComment(D2TabBegin-1+d2tabrow)@" D2TabRelWidth(2)= 1.5 D2TabNumSize(2) = 2.35 '************************ Filtrage *************************** D2TabHeaderTxt(3,1)= "Filtrage" D2TabTxtType(3) = "column defined headline" D2TabDataType(3)="Expression" D2TabVariable(3)="@@ChnPropValGet(D2TabBegin-1+d2tabrow, ""Filter"")@@" D2TabRelWidth(3)= 1.0 D2TabNumSize(3) = 2.35 '''''**************** Minimum ***** D2TabHeaderTxt(4,1)= "Minimum" D2TabTxtType(4) = "column defined headline" D2TabDataType(4)="Expression" D2TabVariable(4)= "@str(CMin(D2TabBegin-1+d2tabrow), ""d.dd"")@" D2TabRelWidth(4)= 0.5 D2TabNumSize(4) = 2.35 '**********************Temps de minimum **** D2TabHeaderTxt(5,1)= "Temps de minimum" D2TabTxtType(5) = "column defined headline" D2TabDataType(5)="Expression" D2TabVariable(5)="" D2TabRelWidth(5)= 1.0 D2TabNumSize(5) = 2.35 '********************** Maximum *********** D2TabHeaderTxt(6,1)= "Maximum" D2TabTxtType(6) = "column defined headline" D2TabDataType(6)="Expression" D2TabVariable(6)="@str(CMax(D2TabBegin-1+d2tabrow), ""d.dd"")@" D2TabRelWidth(6)= 0.5 D2TabNumSize(6) = 2.35 '*********************** Temps de maximum *************' D2TabHeaderTxt(7,1)= "Temps de maximum" D2TabTxtType(7) = "column defined headline" D2TabDataType(7)="Expression" D2TabVariable(7)="" D2TabRelWidth(7)= 1.0 D2TabNumSize(7) = 2.35 '************************* Unité ********************'''' D2TabHeaderTxt(8,1)= "Unité" D2TabTxtType(8) = "column defined headline" D2TabDataType(8)="Expression" D2TabVariable(8)="@Cd(D2TabBegin-1+d2tabrow)@" D2TabRelWidth(8)= 0.4 D2TabNumSize(8) = 2.35 Call GraphObjClose(TableName) End Sub ' CreateTable()
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-26-2012 04:59 AM
Hi,
Thank you very much for your help. That's it the idea which I want to develop but I obtain more than 20 tables and the informations appear only on the five first tables.
Could you give me an idea to appear want I want?
One more time, thank you for the help
03-27-2012 06:33 AM
Hi Brad,
Thank you very much.
it works perfectly, I just changed the loop level for the multi-page
Many thanks for your help
03-28-2012 03:47 PM
Hi,
03-29-2012 12:46 PM - edited 03-29-2012 12:50 PM
Hi Klifoufou,
Here's a new version of the script I posted before, with changes to scale the size of the last page's table and table header to match the row height and header height of the previous pages:
OPTION EXPLICIT Dim i, iMax, voie, Filt, NumTableRows, FirstRow, LastRow, RowRatio For voie = 1 to ChnNoMax Select Case UCase(Right(CN(voie), 1)) case "0" : Filt = "Unfiltered" case "P" : Filt = "Native data" case "A" : Filt = "CFC1000" case "B" : Filt = "CFC600" case "C" : Filt = "CFC180" case "D" : Filt = "CFC60" case "X" : Filt = "Without Filter" end select Call ChnPropValSet(voie, "Filter", Filt) next ' voie NumTableRows = 20 iMax = ChnNoMax/NumTableRows IF CLng(iMax) < CDbl(iMax) THEN iMax = CLng(iMax + 1) Call PicDelete() 'clear DIAdem Graph Call WndShow("REPORT") FOR i = 1 TO iMax IF i = 1 THEN Call GraphSheetInfos() Call GraphSheetNGet(GraphSheetCount) Call GraphSheetRename(GraphSheetName, "Table " & i) ELSE Call GraphSheetNew("Table " & i) END IF FirstRow = 1 + (i-1)*NumTableRows LastRow = i*NumTableRows IF LastRow > ChnNoMax THEN LastRow = ChnNoMax RowRatio = (LastRow-FirstRow+1)/NumTableRows Call GraphSheetRefSet("Table " & i) Call CreateTable("PropTable", FirstRow, LastRow, 1, RowRatio) Call PicUpdate NEXT ' i Sub CreateTable(TableName, RowStart, RowStop, RowStep, RowRatio) Dim TblRange, HdrRange, RowRange, NewRowRange, NewTblRange Call GraphObjNew("2D-Table", TableName) Call GRAPHObjOpen(TableName) D2TabBegin = RowStart D2TabEnd = RowStop D2TabNoDist = RowStep D2TabAutoScalTyp = "fixed" D2TabTop = 1 D2TabBottom = 1 D2TabLeft = 1 D2TabRight = 1 D2TabXDoubleLine = 1 D2TabYDoubleLine = 1 D2TabTxtAutoScal = 1 D2TabGrid(1) = 1 D2TabGrid(2) = 1 D2TabNumAutoScal = 0 '''************************Nom************************* D2TabHeaderTxt(1,1)= "Nom" D2TabTxtType(1) = "column defined headline" D2TabDataType(1)="Expression" D2TabVariable(1)="@ChnName(D2TabBegin-1+d2tabrow)@" D2TabRelWidth(1)= 1.0 D2TabNumSize(1) = 2.35 '************************ Description ***************** D2TabHeaderTxt(2,1)= "Description" D2TabTxtType(2) = "column defined headline" D2TabDataType(2)="Expression" D2TabVariable(2)="@ChnComment(D2TabBegin-1+d2tabrow)@" D2TabRelWidth(2)= 1.5 D2TabNumSize(2) = 2.35 '************************ Filtrage ******************** D2TabHeaderTxt(3,1)= "Filtrage" D2TabTxtType(3) = "column defined headline" D2TabDataType(3)="Expression" D2TabVariable(3)="@@ChnPropValGet(D2TabBegin-1+d2tabrow, ""Filter"")@@" D2TabRelWidth(3)= 1.0 D2TabNumSize(3) = 2.35 '''''**************** Minimum ************************* D2TabHeaderTxt(4,1)= "Minimum" D2TabTxtType(4) = "column defined headline" D2TabDataType(4)="Expression" D2TabVariable(4)= "@str(CMin(D2TabBegin-1+d2tabrow), ""d.dd"")@" D2TabRelWidth(4)= 0.5 D2TabNumSize(4) = 2.35 '**********************Temps de minimum *************** D2TabHeaderTxt(5,1)= "Temps de minimum" D2TabTxtType(5) = "column defined headline" D2TabDataType(5)="Expression" D2TabVariable(5)="" D2TabRelWidth(5)= 1.0 D2TabNumSize(5) = 2.35 '********************** Maximum ********************** D2TabHeaderTxt(6,1)= "Maximum" D2TabTxtType(6) = "column defined headline" D2TabDataType(6)="Expression" D2TabVariable(6)="@str(CMax(D2TabBegin-1+d2tabrow), ""d.dd"")@" D2TabRelWidth(6)= 0.5 D2TabNumSize(6) = 2.35 '*********************** Temps de maximum ************* D2TabHeaderTxt(7,1)= "Temps de maximum" D2TabTxtType(7) = "column defined headline" D2TabDataType(7)="Expression" D2TabVariable(7)="" D2TabRelWidth(7)= 1.0 D2TabNumSize(7) = 2.35 '************************* Unité ********************** D2TabHeaderTxt(8,1)= "Unité" D2TabTxtType(8) = "column defined headline" D2TabDataType(8)="Expression" D2TabVariable(8)="@Cd(D2TabBegin-1+d2tabrow)@" D2TabRelWidth(8)= 0.4 D2TabNumSize(8) = 2.35 '======================= Scale the Table =============== TblRange = 100 - D2TabTop - D2TabBottom HdrRange = TblRange*D2TabTxtField/100 RowRange = TblRange - HdrRange NewRowRange = RowRange*RowRatio NewTblRange = HdrRange + NewRowRange D2TabBottom = 100 - D2TabTop - NewTblRange D2TabTxtField = 100*HdrRange/NewTblRange Call GraphObjClose(TableName) End Sub ' CreateTable()
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-30-2012 02:15 AM
Hi Brad,
Thank you very much.
it works perfectly
04-12-2012 06:21 AM
Hello Brad,
I come to you today hoping you can help me even this time.
Always the same problem in the table, but this time, I find that difficult if I compare it to the last time.
This time I try to make a page that summarizes the results of the accident: HIC (36/15), RESULTING Acceeleration, cumulative 3ms, NIC, VC, ThCC .... And which can be used for any case. In a first time , I will interested to the driver (AVG) and passenger (AVD)
you can find below an example that summarizes what I'm trying to do
I hope that you understand what I want to do.
Thank you
04-12-2012 07:08 AM
Hi klifoufou,
What we can do in a DIAdem 2011 table is conditionally color the text or change its other text properties such as bold or font. The method to do this is very flexible, but not obvious at all. You have to create a VBScript that analyzes the value of a cell and assigns the appropriate coloring, font, etc. Then you have to make that VBScript a global user command. Then you have to edit the table configuration to call that VBScript when redrawing the table cells in REPORT.
Here's an example,
Brad Turpin
DIAdem Product Support Engineer
National Instrument