Skip to main content
September 30, 2020

Does anyone know how I can use XFSqlTableEditorSaveDataTaskInfo?

  • September 30, 2020
  • 3 replies
  • 0 views
Originally posted by Cosimo Palmisano

7/19/2018

I've got a SQL Table Editor component in a dashboard that queries an SQL View that outer joins two tables. The user can update some fields in a record within the SQL Table Editor component and when they hit save, I call a Dashboard Extender rule that processes the dirty records within the component. The rule starts off by creating an XFSqlTableEditorSaveDataTaskInfo object but not sure where to take it from here. There's the property XFSqlTableEditorSaveDataTaskInfo.EditedDataRows which I assume is a collection of dirty records from the Table component. I'd like to get the ModifiedDataRow values on fields that were updated in the table component so I can write them back to one of the source tables used in the SQL view. Anyone have an example on how to get the value from a modified field?

3 replies

September 30, 2020
Originally posted by Celvin Kattookaran

think you can loop through all editedrows
For Each modRow As XFEditedDataRow In saveDataTaskInfo.EditedDataRows

brapi.ErrorLog.LogMessage(si, modRow.ModifiedDataRow.Item(""columname"").ToString)

Next

You cannot update a view you need to update underlying tables. It works fine for me if I update the data from a table.

October 2, 2020
Originally posted by Frank Dossing

As @Celvin Kattookaran mentions, iterate over the rows, checking if a row if an update/insert/delete type. Then build a sql statement to modify the relevant tables on in the database 

For Each row as XFEditedDataRow in args.SqlTableEditorSaveDataTaskInfo
  If row.InsertUpdateOrDelete = DbInsUpdateDelType.Update
     'If a row is updated, add to an "Update" sql command
  ElseIf row.InsertUpdateOrDelete = dbInsUpdateDelType.Insert
     'If a row is an insert, add to an "Insert" sql command
  End if
Next

 

When returning from the function, make sure to return a XFSqlTableEditorSaveDataTaskResult object, setting the '.CancelDefaultSave' to true:

Dim xfResult As New XFSqlTableEditorSaveDataTaskResult
xfResult.CancelDefaultSave = True
xfResult.IsOK = True
xfResult.ShowMessageBox = False
Return xfResult
October 19, 2020
Originally posted by Celvin Kattookaran

think you can loop through all editedrows
For Each modRow As XFEditedDataRow In saveDataTaskInfo.EditedDataRows

brapi.ErrorLog.LogMessage(si, modRow.ModifiedDataRow.Item(""columname"").ToString)

Next

You cannot update a view you need to update underlying tables. It works fine for me if I update the data from a table.