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)

X++ Job Error: Operand types are not compatible with the operator.

(0) ShareShare
ReportReport
Posted on by 165

I'm trying to update some records in CustTable. I wanted to change the field MainContactWorker (Employee Responsible). The idea is that there will be some changes made in CustTable - Employee responsible for like 1000 customers and it would not be convenient to do this by hand.
There is a relation between CustTable and HcmWorker: CustTable.MainContactWorker == HcmWorker.RecId. And I don't really know if this is a problem. Both fields' types are the same: "int64", but the EDTs are different. However, I wrote this simple (and obviously - incorrect) job and received the following error:
JOB's code:

Static void UpdateMCW(Args _args)
{
CustTable ct;
;
While select forupdate ct where ct.MainContactWorker=="5637178326"

{
If(ct)
{
Ttsbegin;

Ct.MainContactWorker=“5637172326”;
Ct.update();

Ttscommit;
}
}
}




Error:
Description: Operand types are not compatible with the operator.
Path: \Jobs\UpdateMCW
Line: 5
Diagnostic ID: Err:1


The value given for the where clause is underlined - "5637178326".
So my question is - how can I fix this error and get the records updated?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    304,419 Super User 2026 Season 1 on at

    Hi Elena,

    Remove the quotation characters (") as this indicates the value should be interpreted as a string. Without these, it will recognize the recid value correctly.

  • Community Member Profile Picture
    on at

    Hi

    I am trying use the parameter but getting the following error

    while   select crossCompany TaxCode from TaxTrans where TaxTrans.DATAAREAID == prTransDataArea

    Error

    Operand types are not compatible with the operator.

  • André Arnaud de Calavon Profile Picture
    304,419 Super User 2026 Season 1 on at

    Hi Avinash,

    How did you declare your variable prTransDataArea? What object type is used here? It should be a string of at least 4 characters.

  • Community Member Profile Picture
    on at

    Thank you Mr. Andre Arnaud de Calavon, I created lookup for legal entity and I am trying to use the parameter value as selected legal entities. I used the following code

    private void lookupLegalEntity(FormStringControl    _legalEntityLookup)

    {

       Query                   query;

       QueryBuildDataSource    qbds;

       SysTableLookup          sysTableLookup;

       container cnt;

           query = new Query();

           qbds = query.addDataSource(tableNum(CompanyInfo));

           qbds.addSelectionField(fieldNum(CompanyInfo, DataArea));

           qbds.addOrderByField(fieldNum(CompanyInfo, DataArea));

           SysLookupMultiSelectGrid::lookup(query, _legalEntityLookup, _legalEntityLookup, cnt);

    }

    Contract Class

    [

       DataMemberAttribute("DataArea"),

       AifCollectionTypeAttribute("DataArea", Types::String),

       SysOperationLabelAttribute(literalStr("CompanyInfo"))

    ]

    public List parmCompany(List _DataArea = DataArea)

    {

       DataArea = _DataArea;

       return DataArea;

    }

    DP Class

    [SysEntryPointAttribute]

    public void processReport()

    {

       TaxTrans    TaxTrans;

         dataContract = this.parmDataContract() as TaxListCustomizedContract;

    ttsBegin;

    delete_from TmpTaxTransaction;

    //while   select crossCompany TaxCode from TaxTrans  where TaxTrans.DATAAREAID == ''

    while   select crossCompany TaxCode from TaxTrans  where TaxTrans.DATAAREAID == DataArea

       {

           TmpTaxTransaction.TaxAmount=TaxTrans.TaxAmount;

           TmpTaxTransaction.TaxAmount=TaxTrans.TaxBaseAmount;

           TmpTaxTransaction.TaxBaseQty=TaxTrans.TaxBaseQty;

           TmpTaxTransaction.TaxCode=TaxTrans.TaxCode;

           TmpTaxTransaction.TaxInCostPriceMST=TaxTrans.TaxInCostPriceMST;

           TmpTaxTransaction.TaxOrigin=TaxTrans.TaxOrigin;

           TmpTaxTransaction.TransDate=TaxTrans.TransDate;

           TmpTaxTransaction.insert();

       }

       ttsCommit;

    }

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Your DataArea variable seems to be of type List. You can't compare a list with a string.

    Why is it a List? If you change it to DataAreaId your code will work.

    Or, if you need to be able to give a list of company ids as a parameter, you need to change your processReport method. Iterate the List, take one DataAreaId at a time, and run your select statement once for each. Or, for better performance, change your select statement to a query (with Query object) and add all the DataAreaIds as ranges to that query.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Nikolaos,

    Thank you for your support and its working fine

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
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 4 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans