My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

14 November 2009

Not like syntax in X++

by Patrik Luca 0 comments

Tag



Business Requirement: use of not like functionality in X++

The like condition allows you to use wildcards in where clauses of an SQL statement. The not like condition as supported in SQL is not supported in X++.

Solution: use the exclamation mark

Suppose you want to find all customers in the CustTable whose Name doesn’t start with Light. As the not like condition is not supported in X++, you need to achieve this by using the exclamation mark. The exclamation mark is used throughout Dynamics AX to filter records not equal some value. In our example this would become:

static void UseOfNotLike(Args _args)
{
CustTable custTable;
;

while select custTable
where !(custTable.Name like "Light*")
{
info(strFmt("Customer account: %1, Name: %2"
,custTable.AccountNum
,custTable.Name));
}
}

Comments 0 comments

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links