Thursday, September 14, 2017

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

I had a requirement to store huge data of xml into AX table i.e. I used string size as [MEMO].
Response1, Response2 & Response3 are Memo Fields.

Now my requirement is to perform to select some data based on where conditions checking Response 1, Response 2 &; Response 3 parameters but it gives me Error

  while select * from appLog
            where appLog.ReceiptNo == ""  && appLog.Response1 != "" && appLog.Response2 != "" && appLog.Response3 == ""
        {
                resultSet.addEnd(appLog.Response2);
       
        }


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

Note: After finding error details I came to know you can not use MEMO fields in where clause and have to use IF condition .

Therefore the query was changed as below.

  while select * from appLog
            where appLog.ReceiptNo == ""
        {
            response1 = appLog.Response1;
            response2 = appLog.Response2;
            response3 = appLog.Response3;
         
            if(response1 != "" && response2 != "" && response3 == "")
            {
                resultSet.addEnd(appLog.Response2);
            }
        }