web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

TaxPurch::calculateTax takes very long time when updating a Purchase Order Line's PurchPrice

(0) ShareShare
ReportReport
Posted on by

I am just trying to update the PurchPrice of some lines in a Purchase order.

for that, I wrote a simple loop to update the prices one by one. 

                do
                {
                    row++;
                    lineNumber = cells.item(row, 1).value().double();
                    purchId =    cells.item(row, 2).value().bStr();
                    purchPrice =  cells.item(row, 3).value().double();
                    type = cells.item(row+1, 1).value().variantType();

                    select forUpdate purchLine
                    where purchLine.PurchId == purchId
                    && purchLine.LineNumber == lineNumber;

                    if (purchLine)
                    {
                            purchLine.PurchPrice = purchPrice;
                            purchLine.LineAmount = purchLine.PurchPrice * purchLine.QtyOrdered;
                            purchLine.update();
                            doneCntr++;
                    }

                }
                while (type != COMVariantType::VT_EMPTY);

but I understood that the task is extremely slow (it takes hours to update 100 lines). so, I tried to figure out the reason with Trace Parser. and the following is the result of this experiment. It takes a long time to do TaxPurch::calculateTax 

TraceParser.PNG

Would you please help me find out the answer to following questions?

Why is this action so slow?

What this action is for and do I have to perform it just for updating PurchPrice?

How can I fix it?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    What is TaxPurch::calculateTax action for at all?

    Do I have to calculate all the Tax again with it?

  • Community Member Profile Picture
    on at

    Yes, it's all the same as the trace parser screenshot I have posted above.  When I drill down, I just find other methods that are called. it's not a single SQL line or something like to check its indexing and performance issue.

    Is that possible to force the PO to stop calculating tax on updating each line and do it at the end of updating?

  • Community Member Profile Picture
    on at

    Dear Sukrut, it's all the same. just bunch of methods that are running. I could find two queries that were somehow time consuming and updated their statistics but didn't have any notable impact.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans