DIAdem Help

Object: TransformDataContextX

  • Updated2024-09-12
  • 2 minute(s) read

Object: TransformDataContextX

The TransformDataContextX object provides the input and output channels for the curve transformation as an object in a 2D table in DIAdem REPORT. The user command receives the TransformDataContextX object as a parameter. Use the curve transformation user command only to manipulate the values of temporary copies of the input channels. REPORT objects such as the worksheet, the axis system, and the curves can only be accessed in read-only mode.

Note  To test the example script, you must first save the second script and register it as a user command in the dialog box that opens when you select Settings»Extensions»User Commands.

The following example generates a 2D table with two columns, specifies the column properties, and assigns the MyOnChannelTransformation user command to the second column:

Dim oMy2DTable, oMyColumn, oMyColumnTrans
Call Report.NewLayout()
Set oMy2DTable = Report.ActiveSheet.Objects.Add(eReportObject2DTable,"My2DTable")
oMy2DTable.Position.ByBorder.Top = 30
oMy2DTable.Position.ByBorder.Bottom = 20
oMy2DTable.Position.ByBorder.Left = 20
oMy2DTable.Position.ByBorder.Right = 30
Set oMyColumn = oMy2DTable.Columns.Add(e2DTableColumnChannel)
oMyColumn.Channel.Reference = "[1]/[2]"
Set oMyColumnTrans = oMy2DTable.Columns.Add(e2DTableColumnChannel)
oMyColumnTrans.Channel.Reference = "[1]/[2]"
oMy2DTable.Settings.UseChannelTransformation = True
oMyColumnTrans.OnChannelTransformation = "MyOnChannelTransformation"
Call Report.Refresh()

The user command summates all values in the columns and returns the results in the second column:

Sub MyOnChannelTransformation(TransformContext)
  Dim oMyDataContext
  Set oMyDataContext = TransformContext.DataContext
  Call ChnSum(oMyDataContext.ChannelNumberIn, oMyDataContext.ChannelNumberOut) 'Calculates the sum of the channel values
End Sub