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

By dsandor at July 16, 2009 23:59
Filed Under:

Here is a really simple error / solution. I came back to writing X++ after a few weeks of down time and actually forgot about this as I am predominately a C# programmer.

The problem:

Axapta does not want you to use an unbounded string in a where clause. 

The solution:

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

Example:

PurchTable getFirstByCustomerPOId(str 30 customerPOId)
{
    PurchTable purchTable;
    ;

    purchTable.selectForUpdate(true);

    select firstonly purchTable
        where purchTable.My_CustomerPurchaseOrderId == customerPOId;

    return purchTable;
}

Comments are closed