The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
RobbSalzmann
3 years agoValued Contributor II
SQL Table Editor Unable to Save Data
OS Version 7.4.2 I have a SQL Table Editor in a dashboard. Three columns: Date, Amount, Descr. The user can edit Amount and Descr. No Inserts, no deletes. The table loads with a bunch of dates. ...
- 3 years ago
That is interesting. It should do what you are doing as a SQL already unless somehow the keys are messed up, and SQLTableEditor is sending queries to update multiple records.
- 3 years ago
Yep, I added a PK column and the STE cooperates. Professionally I have some thoughts about this, but I'll leave it as solved and kudo you the solution for giving me the idea and the time you spent sharing your thoughts! Cheers.
ckattookaran
3 years agoValued Contributor
Not sure why you are trying to remove the insert and updates.
Private Sub SaveRecords(si As SessionInfo, args As DashboardExtenderArgs)
Try
Using dbConn As DBConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
dbConn.BeginTrans()
BRApi.Database.SaveDataTableRows(dbConn, args.SqlTableEditorSaveDataTaskInfo.SqlTableEditorDefinition.TableName, args.SqlTableEditorSaveDataTaskInfo.Columns, args.SqlTableEditorSaveDataTaskInfo.HasPrimaryKeyColumns, args.SqlTableEditorSaveDataTaskInfo.EditedDataRows, True, False, True)
dbConn.CommitTrans()
end using
Catch ex As Exception
Throw New XFException($"{Environment.NewLine}{Me.GetType().ToString()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}(): {ex.Message}", ex)
End Try
End Sub
Is the above not working? Also I do see why you are creating a DbConn variable, but a Using should works just fine isn't it?
- RobbSalzmann3 years agoValued Contributor II
Since the STE cannot save the data on its own, I parse the modified rows and save the updates/inserts with queries.
The modified rows must be removed to allow the UI to refresh and update the STE with new (manually updated) entries.If I use the default SQL Table Editor code supplied by OneStream in the Rule, the error in the log is:
A using block implies the System.IDisposeable interface is implemented. DBConnInfo does not seem implement this interface. I find outside declarations and the Try-Catch-Finally approach is better for debugging. - RobbSalzmann3 years agoValued Contributor II
ckattookaran I replaced my code with yours and ran it. Here are the results:
IMO, the default STE helper code supplied with the Dashboard Extender rules is flawed in its error handling. I use what I posted to overcome this.
Related Content
- 2 months ago