Adapter BeforeUpdateRecord
 
Forums / SmartComponent Library - Developer Forum / Adapter BeforeUpdateRecord

Adapter BeforeUpdateRecord

4 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    19 Jan 2019
    Link to this post
    We are using the SmartBusinessEntityAdapter "BeforeUpdateRecord" to assign a "calculated field" to TRUE. When the changed record gets to the backend the value of this calculated field does not match what we are setting it to on the front end. I have confirmed the value is correct after the code below. Should this work or do we need to drop a field on the form in order for it to work?

    /*------------------------------------------------------------------------------
      Purpose: Called before we update the record. We will use this to set the AddToCounts
               flag so the backend knows we are not replacing.
      Notes:
     ------------------------------------------------------------------------------*/
     
     METHOD PRIVATE VOID AdjLineAdapter_BeforeUpdateRecord( INPUT sender AS System.Object, INPUT e AS Consultingwerk.SmartComponents.Implementation.BeforeUpdateRecordEventArgs ):
      
     ASSIGN
       e:BufferHandle:BUFFER-FIELD ("AddToCounts"):BUFFER-VALUE = TRUE
       .
       
     END METHOD.
  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    Answered
    19 Jan 2019 in reply to Roger Blanchard
    Link to this post
    When the field is included in the BindingSource schema, you should use the AfterAssignRecord event. Otherwise, the value of the BindingSource (regardless if it's bound to an UI control) will overwrite whatever you have set.
  3. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    19 Jan 2019 in reply to Mike Fechner
    Link to this post
    Ah, let me try that. Thanks for the quick response.
  4. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    19 Jan 2019 in reply to Mike Fechner
    Link to this post
    works great, thanks.
4 posts, 1 answered