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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

The operand is not compatible with the type of the function.

(0) ShareShare
ReportReport
Posted on by

Hi Friends;

Here below is the code for my Display method, it gives me an error message "The operand is not compatible with the type of the function".  Here my motive is show automatic invoice reference field in vendor invoice journal

Display Real Invoicereference()
{

purchTable purchTable;

PurchParmTable PurchParmTable;


while select purchTable
where purchTable.purchID == vendInvoiceJour.purchID
join PurchParmTable
where PurchParmTable.PurchId == purchTable.purchId &&
PurchParmTable.InvoiceAccount == vendInvoiceJour.InvoiceAccount 

return (PurchParmTable.AutomaticInvoiceReference) ;
}

Can some one tells me exactly what did I do wrong? Thanks for your Time.

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    48,972 User Group Leader on at
    RE: The operand is not compatible with the type of the function.

    I can see three doubts in your code

    1) you are using a while select statement, whereas I believe you are supposed to return a single value; hence you should use select firstonly

    2) you are should put a semicolon at end of your select statement;

    3) you ReturnType for the method is Real, whereas you are returning PurchParmTable.AutomaticInvoiceReference ; I am doubtful if AutomaticInvoiceReference is a Real Type field ??

  • Community Member Profile Picture
    on at
    RE: The operand is not compatible with the type of the function.

    Thank you very much Sohaib, I correct code but it show null vale.

  • Sohaib Cheema Profile Picture
    48,972 User Group Leader on at
    RE: The operand is not compatible with the type of the function.

    you have to debug it to know why its giving you null value

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: The operand is not compatible with the type of the function.

    Hi Shivansh,

    Check if the joins are correct so as to see why its returning null. Then like Sohaib said, the return type should not be real.

  • Community Member Profile Picture
    on at
    RE: The operand is not compatible with the type of the function.

    Selecting PurchParmTable does not seem good or practical to me. If you want to display a field from the journal you should select the actual journal table (VendInvoiceJour).

  • Community Member Profile Picture
    on at
    RE: The operand is not compatible with the type of the function.

    Thanks to all for valuable suggestions.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans