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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Update OrdersEndDate in Trade Promotions Tables

(0) ShareShare
ReportReport
Posted on by 333

I am trying to update the OrdersEndDate for our Trade Promotions from 12/29/2017 to 12/29/2025. 

Here is my code but i am getting a Operand Types are not compatible with the operator.  Any guidance i would greatly appreciate it.  My x++ skills are a work in progress.

static void AMF_RebateDateUpdate(Args _args)
{
jsTPMTradePromotion jsRebates;


while select forUpdate jsRebates where jsRebates.OrdersEndDate =="12/29/2017"

{

ttsBegin;
jsRebates.OrdersEndDate = '12/29/2025';
jsRebates.update();
ttsCommit;

}
print info('Completed');
pause;
}

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Use following code:

    static void AMF_RebateDateUpdate(Args _args)
    {
        jsTPMTradePromotion jsRebates;
        TransDate transDate;
    
        transDate = mkDate(12, 29, 2017);    
        
        while select forUpdate jsRebates where jsRebates.OrdersEndDate == transDate
        {
            ttsBegin;
            jsRebates.OrdersEndDate = mkDate(29,12,2025);
            jsRebates.update();
            ttsCommit;
        }
        print info('Completed');
        pause;
    }


  • Suggested answer
    ScorpioDax Profile Picture
    333 on at

    Hi Chaitanya ,

    Thanks for the guidance.  The code worked perfectly except for the mkDate format was backwards, i caught that and changed it and worked perfectly.

  • Suggested answer
    ScorpioDax Profile Picture
    333 on at

    Hi Sukrut,

    Thank you for the info.  That was the issue in this case, i need to familiarize myself with the data types more.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans