10-14-2020 03:44 AM - edited 10-14-2020 03:46 AM
I need a simple table (2 columns, 4 to 10 rows)
I wish to populate this table with data values that are stored in an arrays
I am using Diadem 2019SP1
I have seen previous posting for older versions of Diadem, but they did not use the Reports object model.
Using a 2dTable of column type e2DTableColumnExpression I can use an expression to populate it with a variable.
But how do I get the value of each array element into each row? Currently I am hardcoding a specific index in the Expression property
GlobalDim("sCalcValues")
GlobalDim("sCalcDesc")
sCalcDesc = Array ("Res 01", "Res 0", "Res 03", "Res 04", "Res 05")
sCalcValues = Array("1.23", "2.23", "3.333", "3.45", "3.165")
Dim oMy2DTable, oMyPosition, oMyColumn
Call Report.NewLayout()
Set oMy2DTable = Report.ActiveSheet.Objects.Add(eReportObject2DTable,"My2DTable")
Set oMyPosition = oMy2DTable.Position.ByBorder
oMyPosition.Top = 30
oMyPosition.Bottom = 20
oMyPosition.Left = 20
oMyPosition.Right = 30
Set oMyColumn = oMy2DTable.Columns.Add(e2DTableColumnExpression)
oMyColumn.Expression = "@@sCalcValues(2)@@"
oMyColumn.ExpressionMaxIndex = 3
oMyColumn.Settings.Font.Color.SetpredefinedColor(ePredefinedColorBlue)
oMy2DTable.Settings.IndexSettings.IndexMode = e2DTableIndexModeAutomaticMinimum
Call Report.Refresh()
oMyColumn.
oMyColumn.Settings.Font.Color.SetpredefinedColor(ePredefinedColorBlue)
oMy2DTable.Settings.IndexSettings.IndexMode = e2DTableIndexModeAutomaticMinimum
Call Report.Refresh()
10-15-2020 07:05 AM
Have managed to find a solution. There is a variable called D2TabRow which holds the current row number.
oMyColumn.Expression = "@@sCalcValues(D2TabRow)@@"
10-19-2020 06:49 AM
Building a new report sheet with a new table object requires a lot of programming to update all of the possible cosmetic options. It is considerably easier to append a report sheet with a table object that has the basic formatting desired, and then programmatically add columns and rows to it, applying special formatting as needed.
The attached script in the .zip file creates basic channel data in the Data Portal, adds a report template with a table object, adds columns and rows, updates cells with the channel data from the Data Portal, and performs some formatting. A text channel is used in the example, but it could be a numeric channel.
10-22-2020 06:54 AM
I recommend to put the values in channels, instead of array, cause after you can easier display it in xtable, as there is Channel data type column.