How to use substring function in X++ ax 2009 ?

Sometimes you need to take part of the original string to check on some data
for example :
if you have items start with   MED , FLU,HIV...etc
we need to apply sub string to this words to take only the first character
we will use this function to complete this task :
void test()
{
str Name;
str Result;
;
Name="MED";
Result=substr(name,1,1);
info(strfmt("The original Name : %1,the sub string Result : %2",Name,Result));
}

NOTE :
The info will show this result :
The original Name : MED  the sub string Result : M

Comments

Anonymous said…
Hi Abdel,
This was a big help(specially for newbies in AX). If I need to build a conditional statement, let's say:
if(result =='xxx')
{
return 'Test';
}
else{
return yyy;
}
Is that syntax will work in AX(ax 2009)


Thank you!
Alex
aadlaryan@amtrol.com
momogrosir said…
thanks for the tutorial

Popular Posts