April 10, 2013

Container and unbounded string (text) fields are not allowed in a WHERE expression in AX.

Container and unbounded string (text) fields are not allowed in a WHERE expression in AX.

Error: Container and unbounded string (text) fields are not allowed in a WHERE expression in AX.

Reason: Axapta does not allow you to use an unbounded string in a where clause.

cont

Solution:

You must use a ‘bounded’ string. To do this you must declare your string with a numerical limiter e.g. str 50.


Example:

PurchTable getFirstByCustomerPOId(str 50 customerPOId)
{
PurchTable purchTable;
;
purchTable.selectForUpdate(true);
select firstonly purchTable
where purchTable.My_CustomerPurchaseOrderId == customerPOId;
return purchTable;
}


-Harry