Some functions used in X++

20 Feb

strRem Removes the characters specified in one string from another string.
str strRem(str text1, str text2) where text1 : The string from which to remove characters.text2 : The characters to exclude from the output string.


Retrieves part of a string.
str subStr(str _text, int _position, int _number)

where_text : The original string._position : The position in the original string where the part to retrieve begins.

_number : A signed integer that indicates the direction and number of positions to retrieve from the original string.
If there is a minus sign preceding _number, the system selects the substring backward from the specified position.


Creates a copy of a string with the specified substring removed.
str strDel( str _text, int _position, int _number)

where_text : The string to copy from_position : The position at which to begin ignoring characters during the copy.

_number : The number of characters to ignore.
A minus in front of _number parameter indicates that the (_number-1) characters before the character at the _position parameter are to be removed along with the character at the _position.

Formats the specified string and substitutes any occurrences of %n with the nth argument.
str strFmt(str _string, …)where _string : The strings to be formatted.

example: to set the number of page in a report :

Display STR 20 pageNum()
return StrFmt(“@SYS24160”,;

Converts a real number to a string.
str num2Str(
real number,
int character,
int decimals,
int separator1,
int separator2)where: number The real number to convert to a string.
character The minimum number of characters required in the text.
decimals The required number of decimal places.
separator1 A DecimalSeparator enumeration value.
separator2 A ThousandSeparator enumeration value.

static void Job_Num2Str(Args _args)
real realNum = 0.1294567890123456777; // 19 decimals places.
info(Num2Str(realNum,0,16,1,3)); // 16 decimals
info(Num2Str(realNum,0,17,1,3)); // 17 decimals
} Round Rounds a real number to the nearest multiple of another real number.real round(real _arg, real _decimals) _arg The original number.
_decimals The number that the value of the _arg parameter must be rounded to a multiple of.

Examples:round(123.45,5.00); //Returns the value 125.00.

round(7.45,1.05); //Returns the value 7.35.

round(23.9,5.0); //Returns the value 25.00;

round(26.1,5.0); //Returns the value 25.00;

Returns the size of a string

int strLen ( Str _text )


Retrieves a specific element from a container.

anytype conPeek(container container, int number)Example:static void conPeekExample(Args _arg)
container c;
int i;

c = conIns([“item1”, “item2”], 1);
for (i = 1 ; i {
print conPeek(c, i);


Converts all the letters in a string to uppercase.

str strUpr(str _text)

static void strUprExample(Args _args)
print strUpr(“Abcdd55EFGhiJ”);
strLwrConverts all the letters in a string to lowercase. str strLwr(str _text)
static void strLwrExample(Args _args)
// Returns the text string “abcdd55efghij”.
print strLwr(“Abcdd55EFGHIJ”);
Units We use it to set the unit of a dimension.Example :“CustInvoiceJour_InvoicingName”);, Units::mm);

Global::dateEndYr Method
Retrieves the date of the last day in the same year as the specified date.
client server public static date dateEndYr(date transDate)
Global::DateMthFwd Method
Adds the specified number of months to a date.
client server public static date DateMthFwd(date transDate, int qty)

Global::DateStartYr Method
Retrieves the first date of the specified year.
client server public static date DateStartYr (date transDate)

tableName2Id FunctionRetrieves the ID of a table.
int tableName2Id(str _name)

1 Comment

Posted by on February 20, 2012 in X++



One response to “Some functions used in X++

  1. momogrosir

    May 30, 2016 at 7:26 am

    it’s work for me

    Liked by 1 person


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Anitha Eswaran - Dynamics Ax

Microsoft Dynamics Ax blog


AxaptaHut ax = new AxaptaHut();

All About Dynamics 365

Dynamics 365, D365, Implementor

Syed Rafay Ali

This blog contains information about Functional techniques and guidelines in Microsoft Dynamics AX, including tips, tricks, tutorials, tools and upcoming news enhancement in Microsoft Dynamics Ax

Philippsen's Blog

Everyday findings in my world of .net and related stuff

Microsoft Dynamics AX

A great site


All things Blockchain, ERP and IoT

Dynamics Ax

Technical Knowledge


A blog about implementing Microsoft Dynamics AX and Dynamics 365 for Operations

Microsoft Dynamics 365 Blog

Start your organization's digital transformation with Dynamics 365, A Blog by Sandeep Chaudhury

DEVSerra - Dynamics AX development blog

Your official Microsoft Dynamics AX blog.


Discovering Dynamics


A blog by Hai Nguyen

Learn Dynamics Ax with Johnkrish

Live as if you were to die tomorrow. Learn as if you were to live forever - Mahatma Gandhi ****** The more I learn, the less I know - Albert Einstein

Twisted Untwirled

Just another site


Just another site

%d bloggers like this: