Friday, November 25, 2016

AX 2012: StrFind and StrScan functions


Two standard functions strFind and strScan can be used based on business requirement for find a special character from an input string.

Here is an example with both functions;

Both functions return integer value.

StrScan Function

Int found = 0;
Str target= "Dynamics AX 365 operation";
found = strScan(target, "365", 0, strLen(target));


where parameters are;
1. string
2. string
3. position
4. number

StrFind Function

Int found = 0;
Str target= "Dynamics AX 365 operation";
found = strFind(target, "X", 0, strLen(target));

where parameters are;
1. string
2. character
3. position
4. number