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)

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
    239,399 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
    239,399 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

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 39

#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