Forum Discussion
JackLacava
3 years agoCommunity Manager
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As Object
Try
Select Case args.ActionType
Case Is = ConnectorActionTypes.GetFieldList
' Here we want to provide the list of fields the connector will provide,
' so we can map them in the DataSource page.
Dim fieldList As New List(Of String)
fieldList.Add("SomeColumn")
fieldList.Add("SomeOtherColumn")
Return fieldList
Case Is = ConnectorActionTypes.GetData
' Here we're actually doing the work of retrieving data.
Dim myData as DataTable = Me.GetSageData(si, globals, api, args)
api.Parser.ProcessDataTable(si, myData, true, api.processInfo)
Return Nothing
Case Is = ConnectorActionTypes.GetDrillBackTypes
' if you want to support DrillBack,
' here you have to declare which types you provide
Dim drillTypes As New List(Of DrillBackTypeInfo)
drillTypes.Add( _
new DrillBackTypeInfo( _
ConnectorDrillBackDisplayTypes.DataGrid, _
New NameAndDesc("SageData","My Sage Data")))
return drillTypes
Case Is = ConnectorActionTypes.GetDrillBack
' if you want to support DrillBack,
' here you have to provide the actual source data
If args.DrillBackType.NameAndDescription.Name.Equals( _
"SageData", StringComparison.InvariantCultureIgnoreCase) Then
' retrieve the row we're drilling for.
' Field names can be found in StageConstants or StageTableFields
Dim sourceValues as Dictionary(Of string, Object) = _
api.Parser.GetFieldValuesForSourceDataRow(si, args.RowID)
Dim drillBackInfo As New DrillBackResultInfo
drillBackInfo.DisplayType = ConnectorDrillBackDisplayTypes.DataGrid
' similarly to GetSageData, getSageDrillback should return a DataTable.
' PageSize and PageNumber can be used to manage pagination.
drillBackInfo.DataTable = me.getSageDrillback( _
sourceValues, si, globals, api, args)
Return drillBackInfo
Else
Return Nothing
End If
End Select
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
function getSageData(ByVal si As SessionInfo, ByVal globals As BRGlobals, _
ByVal api As Transformer, ByVal args As ConnectorArgs) As DataTable
' This is where you would launch your Sage api calls,
' stuffing results in a DataTable.
' Extract parameters can be defined in various ways
' (get the WF period, or the POV, or Text properties on Scenario or WF...)
... do sage stuff here
return myDataTable
end function
function getSageDrillback(ByVal sourceDict as Dictionary(Of string, Object), _
ByVal si As SessionInfo, ByVal globals As BRGlobals, _
ByVal api As Transformer, ByVal args As ConnectorArgs) As DataTable
' get the necessary parameters from sourceDict.
' Field names can be found in StageConstants or StageTableFields
' args.PageSize and args.PageNumber can be used to manage pagination.
... do sage stuff here
return myDataTable
end function
NicolasArgente
3 years agoValued Contributor
Hey JackLacava !
I tried to use the code above, but I am having an issue with the XFDatatable and this line :
drillBackInfo.DataTable = me.getSageDrillback( _
sourceValues, si, globals, api, args)
I can not find any info on this XFDatatable.
I created a dummy datatable :
Private Function dtDummyTable(ByVal sourceDict As Dictionary(Of String, Object), ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As DataTable
'Create a new DataTable with 5 columns
Dim dt As New DataTable()
dt.Columns.Add("Column1")
dt.Columns.Add("Column2")
dt.Columns.Add("Column3")
dt.Columns.Add("Column4")
dt.Columns.Add("Column5")
'Add 10 rows with dummy data
For i As Integer = 1 To 10
Dim row As DataRow = dt.NewRow()
row("Column1") = "Data " & i
row("Column2") = i * 2
row("Column3") = DateTime.Today.AddDays(i)
row("Column4") = True
row("Column5") = 1.23 * i
dt.Rows.Add(row)
Next
Return dt
End Function
So how to drill back to this datatable?
Related Content
- 9 months ago
- 9 months ago
- 10 months ago