02-05-2024 01:15 AM
Dear Community,
Can anyone please guide me the proper usage of the function
BRApi.Database.SaveDataTableRows(dbConnApp, tableName, columns, hasPrimaryKeyColumns, editedDataRows, throwIfRowForUpdatesDoesntExist, throwIfRowForDeleteDoesntExist, logErrors)
I would like to understand the correct usage of XFDataColumn and XFEditedDataRows in the above function, would appreciate any assistance.
Thank You.
Solved! Go to Solution.
02-05-2024 04:32 AM
Here is an example from the MarketPlace app Data Import Schedule Manager (DSM):
'convert the ado.net data table to an XF data table to access the tables' XF data rows
Dim xfBalanceDT As New XFDataTable(si, auditTableSchema, Nothing, 1)
Dim editedXFDataRows As New List(Of XFEditedDataRow)
Dim newXFRow As New XFDataRow()
newXFRow("TaskID") = randomGuid
newXFRow("SourceDataOriginType") = SourceDataOriginType
newXFRow("WorkFlowSteps") = workFlowSteps
newXFRow("ParallelBatchCount") = ParallelBatch
newXFRow("LoadMethod") = loadMethod
newXFRow("WFTimePeriods") = timePeriods
newXFRow("WFScenarios") = scenarios
newXFRow("Workflows") = workflows
newXFRow("TimeStamp") = DateTime.Now
newXFRow("UserName") = si.UserName
newXFRow("EmailTemplateID") = emailTemplate
newXFRow("AddlDataMgmtTask") = addlTask
newXFRow("AddlTaskBeforeOrAfter") = beforeOrAfter
Dim xfRow As New XFEditedDataRow(DbInsUpdateDelType.Insert, Nothing, newXFRow)
editedXFDataRows.Add(xfRow)
'Inserting the row into our table
Using dbConnInfo As DbConnInfoApp = BRApi.Database.CreateApplicationDbConnInfo(si)
BRApi.Database.SaveDataTableRows(dbConnInfo, "XFW_DSM_WorkflowImports", xfBalanceDT.Columns, True, editedXFDataRows, False, False, True)
End Using
02-05-2024 04:32 AM
Here is an example from the MarketPlace app Data Import Schedule Manager (DSM):
'convert the ado.net data table to an XF data table to access the tables' XF data rows
Dim xfBalanceDT As New XFDataTable(si, auditTableSchema, Nothing, 1)
Dim editedXFDataRows As New List(Of XFEditedDataRow)
Dim newXFRow As New XFDataRow()
newXFRow("TaskID") = randomGuid
newXFRow("SourceDataOriginType") = SourceDataOriginType
newXFRow("WorkFlowSteps") = workFlowSteps
newXFRow("ParallelBatchCount") = ParallelBatch
newXFRow("LoadMethod") = loadMethod
newXFRow("WFTimePeriods") = timePeriods
newXFRow("WFScenarios") = scenarios
newXFRow("Workflows") = workflows
newXFRow("TimeStamp") = DateTime.Now
newXFRow("UserName") = si.UserName
newXFRow("EmailTemplateID") = emailTemplate
newXFRow("AddlDataMgmtTask") = addlTask
newXFRow("AddlTaskBeforeOrAfter") = beforeOrAfter
Dim xfRow As New XFEditedDataRow(DbInsUpdateDelType.Insert, Nothing, newXFRow)
editedXFDataRows.Add(xfRow)
'Inserting the row into our table
Using dbConnInfo As DbConnInfoApp = BRApi.Database.CreateApplicationDbConnInfo(si)
BRApi.Database.SaveDataTableRows(dbConnInfo, "XFW_DSM_WorkflowImports", xfBalanceDT.Columns, True, editedXFDataRows, False, False, True)
End Using
02-05-2024 09:38 AM
Thank You Very Much!!