Forum Discussion
Kneelay
2 years agoNew Contributor II
SQL Table Insert Not adding all Records
HI All,
I'm running into an issue when running a Finance Business Rule, essentially this rule creates a data buffer and loops through where U8 member is not 0. From here we have a SQL statement wh...
- 2 years ago
Dim valueList As List(Of String) = New List(Of String) Dim x As Integer = 0 For Each Cell As DataBufferCell In SrcDataBuffer.DataBufferCells.Values ' Execute If Allocation percentage Is Not equal To 0 If Cell.CellAmount <> 0 Then x += 1 sAcct = Cell.DataBufferCellPk.GetAccountName(api) sUD1 = Cell.DataBufferCellPk.GetUD1Name(api) sFlow = Cell.DataBufferCellPk.GetFlowName(api) sUD2 = Cell.DataBufferCellPk.GetUD2Name(api) sUD4 = Cell.DataBufferCellPk.GetUD4Name(api) valueList.Add($"('{sqlentity}','{sEntitymember}', '{sUD4}', '{sFlow}', '{sUD2}', '{sUD1}', '{sAcct}', {Cell.CellAmount})") End If Next Dim insertValues = String.Join(", ", valueList) Dim sql As String = $"INSERT INTO XFT_BSM_Mapping_Total$ ([BU], [Entity], [BSM_Account], [BSM_Measure], [Responsibility_Center], [Company_Code], [Account],[Allocation_Percentage]) VALUES {insertValues}" brapi.ErrorLog.LogMessage(si,x) Using dbConn As DBConnInfo = BRAPi.Database.CreateApplicationDBConnInfo(si) BRAPi.Database.ExecuteSql(dbConn , sql, True) End Using
Krishna
2 years agoValued Contributor
Kneelay - Are you using Data Table ? or directly importing into the Actual Table (XFT_BSM_Mapping_Table). if not can you try copying the data into data table and perform a bulk copy which is always better in performance.
Kneelay
2 years agoNew Contributor II
Thanks for responding Krishna. We're just directly importing in the Actual Table (XFT_BSM_Mapping Table). Based on your response, just to confirm, could we load directly from the cube to a Data Table? The few examples I have seen in our BR's are all from tables that already exist or external table.
Related Content
- 4 years ago
- 9 months ago