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)

operand types are not compatible with the operator

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

I occasionaly create job that's why i'm not familiar with this type of error, could you please help me ?

public static void LAF_Update_Sales_Orders(Args _args)
{


SalesTable           SalesTable;
int CPT;

ttsBegin ;

while select forUpdate SalesTable where
                        SalesTable.SettleVoucher == "Open transactions"
                        && SalesTable.Salesstatus == "Open Order"


{
    SalesTable.SettleVoucher = None
    CPT = CPT+1;
}

ttsCommit ;

    info(strfmt("fin du script LAF_Update_Sales_Orders '%1'", CPT));

}



Thanks !

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,939 Most Valuable Professional on at

    Please don't forget next time to mention which line of code is throwing the error.

    Fortunately I see the bug - it's salesTable.SalesStatus == "Open Order".

    SalesStatus is an enum field and comparing enums with strings isn't allowed. Use an enum value instead:  salesTable.SalesStatus == SalesStatus::Backorder.

  • Community Member Profile Picture
    on at

    Hi Martin,

    Thanks for your answer, i will pay attention next time.

    One last question, how am i supposed to find the value of the enums SalesStatus::Backorder ?

    Thanks again

  • Verified answer
    Martin Dráb Profile Picture
    237,939 Most Valuable Professional on at

    If you want to work with SalesStatus field of SalesTable, open the table in AOT and look at the field. You'll see that in this case, it doesn't have any Extended Data Type, but it has Enum Type == SalesStatus. Then you can find this enum type under Data Dictionary > Base Enums in AOT and see which elements it has.

  • Community Member Profile Picture
    on at

    Thanks a lot !

  • Suggested answer
    Community Member Profile Picture
    on at

    The final code :

    public static void LAF_Update_Sales_Orders(Args _args)

    {

    SalesTable           SalesTable;

    int CPT;

    ttsBegin ;

    while select forUpdate SalesTable where

                           SalesTable.SettleVoucher == SettlementType::OpenTransact

                           && SalesTable.Salesstatus == SalesStatus::Backorder

    {

       SalesTable.SettleVoucher = SettlementType::None;

       CPT = CPT+1;

    }

    ttsCommit ;

       info(strfmt("fin du script LAF_Update_Sales_Orders '%1'", CPT));

    }

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