Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Data in Temp table doesn't update x++

(0) ShareShare
ReportReport
Posted on by 163

this is form with temp table , I have a validations in this form on close if Sum(allocation ratio) != 100 throw error . 

when I try to update allocation ratio to avoid error data doesn't update 

I try to add TempTable.update() ; on write () or on modified () but doesn't work well 

How can I fix it ?

1882.Screenshot-_2800_113_2900_.png

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Data in Temp table doesn't update x++

    Hi Alex ,

    what I want to do just when I change data in from update and remove error but what happened when I update data to remove error of allocation it didn't change and didn't remove error

  • Alex VN Profile Picture
    Alex VN 1,994 on at
    RE: Data in Temp table doesn't update x++

    Hi Menna,

    This case I think we need to have more information. Possibly you can check as the data is saved in tmp table, hence everytime you open the form it will be a new temp table instance initiated. If you update the 'old' instance, I think it will not have effects so you need to revise the logic.

    Other case is that you might need to refesh the datasource if you can make sure you update the correct table buffer.

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Data in Temp table doesn't update x++

    yes I want if I update data in main grid data update in form , what happened is when I update data in form and save it , it show me the last data not new data I entered

    I try to debug and it hit can close method , but problem appear when error throw doesn't make me to update data after that

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Data in Temp table doesn't update x++

    You can add your logic canClose method also. Where you want to update the allocation ratio? In the main form allocation grid?

    Have you debugged the code? Does the debugger hit?

    Thanks,

    Girish S.

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Data in Temp table doesn't update x++

    Hi Girish , I already do validation on can close () mehtod

    if (Sum(allocationRatio) != 100 )

    {

    throw error

    }

    else

    {

    // some logic

    }

    or you mean to add validation also on closed method ?

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Data in Temp table doesn't update x++

    Hi Menna, You need to refresh Datasource after update, try calling ExecuteQuery method of datasource.

    For reference, check this thread

    www.dynamicsuser.net/.../2

  • Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    RE: Data in Temp table doesn't update x++

    Menna, this is yet another thread of yours that I moved to another thread. Please don't put questions about F&O to Dynamics AX Forum.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Data in Temp table doesn't update x++

    Hi Menna,

    You need to validate the value on closed method of the form. Validate the allocation ratio if its greater then 100 update the table records otherwise throw warning.

    public boolean closed()
    {
        boolean ret;
        if(DataSourceName.AllocationRatio >= 100)
        {
            //update the table
        }
        else
        {
            throw warning("message");
        }
    }

    Thanks,

    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans