Roger Blanchard 
                    
                
                
                        
                            431 posts 
                    
                            Registered: 
                            29 Jun 2018
                        
                    
            
             
            
                
                    
                    
                    
                
                
                
                    25 Mar 2021
                    
                            in reply to
                            
Mike Fechner 
                        
                 
                
                Link to this post 
                Okay, that makes sense for what I am seeing. 
 
When looking at the sample code on the dataset controller TRACKING-CHANGES was being set to TRUE. I assumed incorrectly we had to do that or that it would be FALSE. 
 
What I am trying to do is delete a TT record but not send the delete to the backend. 
 
In my sample below I was not setting TRACKING-CHANGES = TRUE but it is already set. Even though I am not calling SubmitChanges this delete is tracked and will be sent to the backend on the next Submitchanges. 
 
Do you see an issue with me setting TRACKING-CHANGES = FALSE at the beginning of the method and then to true in the FIANLLY? 
 
/*------------------------------------------------------------------------------ 
Purpose: Used to simply remove a record from the grid without actually deleting 
          the record from the DB. What we will do is delete the TT but do 
          not call Submitchanges to the backend. 
Notes: 
------------------------------------------------------------------------------*/ 
 
METHOD PUBLIC LOGICAL RemoveFromGrid(  ): 
 
DEFINE VARIABLE rRowid 		AS ROWID 						NO-UNDO. 
    DEFINE VARIABLE oAdapter 	AS SmartBusinessEntityAdapter 	NO-UNDO. 
     
ASSIGN oAdapter = SmartBusinessEntityAdapter:FromDatasetController (THIS-OBJECT) . 
          
    IF NOT VALID-OBJECT (oAdapter) THEN 
        UNDO, THROW NEW AppError ("A SmartBusinessEntityAdapter needs to be associated with this DatasetController first.", 0) . 
              
    IF VALID-OBJECT (oAdapter:UpdatingSmartDataTarget) THEN 
        UNDO, THROW NEW AppError ("The SmartBusinessEntityAdapter is currently in update mode.", 0) . 
         
   	MESSAGE "RemoveFromGrid...TrackingChanges=" TEMP-TABLE eTagHdr:TRACKING-CHANGES 
   VIEW-AS ALERT-BOX. 
   	 
   	DELETE eTagHdr.  
   	 
   	/* Roger Blanchard / Osprey Retail Systems Feb 26, 2019 
This does not scroll the grid into position  
*/	        
    oAdapter:QueryHandle:QUERY-OPEN () . 
    oAdapter:BindingSource:RefreshAll() . 
    /* Roger Blanchard / Osprey Retail Systems Feb 27, 2019 
We cant reposition to the Rowid as the row has been removed. 
The caller will reposition the grid  
*/ 
    // oAdapter:QueryHandle:REPOSITION-TO-ROWID (rRowid) . 
     
    RETURN TRUE.    
   	 
    CATCH err AS Progress.Lang.Error : 
    	LogManagerWrapper:WriteError(err). 
    	UNDO, THROW err. // throw to caller to handle error  
        // Consultingwerk.Util.ErrorHelper:ShowErrorMessage (err) .        
    END CATCH. 
     
    FINALLY: 
MESSAGE "RemoveFromGrid (End)......TrackingChanges=" TEMP-TABLE eTagHdr:TRACKING-CHANGES 
   VIEW-AS ALERT-BOX.					 
END FINALLY. 
 
END METHOD.