Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 274719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:39:12+00:00 2026-05-12T00:39:12+00:00

In the AfterPost event handler for a ClientDataSet, I need the information if the

  • 0

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.

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.

Example code:

procedure TdmMain.QryTestAfterPost(DataSet: TDataSet);
begin
  if IsInserting(QryTest) then
     // ShowMessage('Inserting')...
  else
     // ShowMessage('Updating');

  QryTest.ApplyUpdates(-1); 
end;

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.

How could I implement the IsInserting function, using information in the ClientDataSet instance QryTest?

Edit: I will try ClientDataSet.UpdateStatus which is explained here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:39:12+00:00Added an answer on May 12, 2026 at 12:39 am

    ApplyUpdates doesn’t give you that information – since it can be Inserting, updating and deleting.

    ApplyUpdates apply the change information stored on Delta array. That change information can, for example, contain any number of changes of different types (insertions, deletions and updatings) and all these will be applied on the same call.

    On TDatasetProvider you have the BeforeUpdateRecord event (or something like that, sleep does funny things on memory 🙂 ). That event is called before each record of Delta is applied to the underlying database/dataset and therefore the place to get such information… But Showmessage will stop the apply process.

    EDIT: Now I remembered there’s another option: you can assign Delta to another clientdataset Data property and read the dataset UpdateStatus for that record.
    Of course, you need to do this before doing applyupdates…

    var
      cdsAux: TClientDataset;
    begin
      .
      . 
      <creation of cdsAux>
      cdsAUx.Data := cdsUpdated.Delta;
      cdsAux.First;
      case cdsAux.UpdateStatus of
        usModified:
          ShowMessage('Modified');
        usInserted:
          ShowMessage('Inserted');
        usDeleted:
          ShowMessage('Deleted'); // For this to work you have to modify  
                                  // TClientDataset.StatusFilter  
      end;
      <cleanup code>
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I just create a Solution that contains 3 projects. Order by build order Silverlight
In every webapp I build, I come across this issue. I want to set
I'm currently using PHP, JAVASCRIPT, MYSQL, XHTML, CSS to develop my site. Note that
I need to post multi-line data via a hidden field. The data will be
My form: class PlanForm(forms.ModelForm): owner = forms.ModelChoiceField(label=, queryset=Profile.objects.all(), widget=forms.HiddenInput()) etc... class Meta: model =

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.