title: How can I detect if ApplyUpdates will Insert or Update data?
body: <p>In the AfterPost event handler for a ClientDataSet, I need the information if the ApplyUpdates function for the current record will do an update or an insert.</p>
  
  <p>The AfterPost event will be executed for new and updated records, and I do not want to declare a new Flag variable to indicate if a 'update' or ' insert' operation is in progress.</p>
  
  <p>Example code:</p>
  
  <pre><code>procedure TdmMain.QryTestAfterPost(DataSet: TDataSet);
  begin
    if IsInserting(QryTest) then
       // ShowMessage('Inserting')...
    else
       // ShowMessage('Updating');
  
    QryTest.ApplyUpdates(-1); 
  end;
  </code></pre>
  
  <p>The application will write a log in the AfterPost method, after ApplyUpdate has completed. So this method is the place which is closest to the action, I would prefer a solution which completely can be inserted in this event handler.</p>
  
  <p>How could I implement the IsInserting function, using information in the ClientDataSet instance QryTest?</p>
  
  <p><strong>Edit</strong>: I will try ClientDataSet.UpdateStatus which is explained <a href="http://etutorials.org/Programming/mastering+delphi+7/Part+III+Delphi+Database-Oriented+Architectures/Chapter+14+Client+Server+with+dbExpress/The+Packets+and+the+Cache/" rel="nofollow noreferrer">here</a>.</p>