Shivangi
11 months agoNew Contributor III
How to make use of 'SaveDataTableRows()'
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.
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