How to capture changed values from web spread?

Posted by: szilbermints on 6 February 2019, 7:10 am EST

    • Post Options:
    • Link

    Posted 6 February 2019, 7:10 am EST

    Hi,

    I need to create a change log, in other words capture all old and all new values for all changed rows.

    I can do it via ado.net DataSet changedRows properies

    (inDS.Tables(0).GetChanges(System.Data.DataRowState.Modified) looping thru those

    But I wonder if there is is a way to do it via some WebSpread attributes directly?

    Thank You

    s

  • Posted 6 February 2019, 11:57 pm EST

    Hello,

    You can get the updated values in the UpdateCommand event server side:

    https://help.grapecity.com/spread/SpreadNet12/ASP2/webframe.html#FarPoint.Web.Spread~FarPoint.Web.Spread.FpSpread~UpdateCommand_EV.html

    Thanks,

    Deepak Sharma

  • Posted 7 February 2019, 3:35 am EST

    Thank You Deepak,

    Couple of things.

    1. I have multiple page output and it looks like it gets triggered when i move to another page

      I d rather have when user clicks “Save” button

    2.It s still not clear how to get “old” and “new” Values? The only thing i could see was “editvalues” array containing one new value

    Thank You

    s

  • Posted 7 February 2019, 10:02 pm EST

    Hello,

    1. Changing the page or sheet will cause a postback. This is the default behavior.

    2. UpdateCommand event fires for each data row and you can get the updated value with

      e.EditValues array and the old value can be fetched with

    fpspread1.ActiveSheetView.Cells[0, e.CommandArgument)

    Thanks,

    Deepak Sharma

  • Posted 14 February 2019, 6:54 am EST

    Thank You Deepak,

    I can get this array via code you provided or via DataSet.

    The strange thing is that if user clicks into another cell on a different row but does not cahnge it it still reports as Changed Record although when i check it’s clearly the same value:

    changedRecords.Rows(1)(6,System.Data.DataRowVersion.Current)

    “a” {String}

    String: “a”

    ?changedRecords.Rows(1)(6,System.Data.DataRowVersion.Original)

    “a”

  • Posted 14 February 2019, 6:25 pm EST

    Hello,

    Update event is fired for each changed row whereas only the cells which has changed data shows the value in EditValues array.

    You can check for unchanged status of the edited values, as shown in the code below in UpdateCommand event:

    
    Dim sv As FarPoint.Web.Spread.SheetView = e.SheetView
    For i = 0 To sv.ColumnCount - 1
        If (Not e.EditValues.Item(i) Is FarPoint.Web.Spread.FpSpread.Unchanged) Then
        updateCmd.Parameters(colName).Value = e.EditValues.Item(i) 
      End If
    Next
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels