Question

I am a beginner in AX .I have tried to to execute a code in AOT job.I got an error like this Operand types are not compatible with the operator. and the code which I have tried to work out is as follows.

static void SelectQueryTest(Args _args)
{
   int64  countItem;
   countItem = (select count(ItemId) from InventTable where InventTable.ItemGroupId== "100").ItemId;
   info(strFmt("Count: %1", countItem));
}

Can anyone help me where I have gone wrong.

Was it helpful?

Solution

The field ItemId is a String so you can not assign it to an int64. Replace count(ItemId) with count(RecId) and use this field as your result. Counting records into field RecId is also good practice as it shows your intention very clearly to someone familiar with AX.

OTHER TIPS

replace :

info(strFmt("Count: %1", countItem));

with this :

info(strfmt("Count: %1", int2str(countItem)));

Hope this help...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top