AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.09.2012, 12:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
axaptacorner: Important function in x++ for AX 2009 and AX 2012
Источник: http://axaptacorner.blogspot.com/201...-2009-and.html
==============

<div dir="ltr" style="text-align: left;" trbidi="on">
Important function in X++
I would like to share some important function in x++ Like subStr(), strCmp(),strDel() , strFind (),strfmt () , strLen (),strLwr (),strUpr (),strRep(),systemDateGet(),today(),trunc (),boxExample (),conins(), conLen(), conPeek(), conNull() which seems to easy but some time became very tough to recall in between to coding, so don’t worry and keep coding…….
Sub String in X++
// for cut a string from given posititon SubStr("ABCDEFGHIJ",7,-4) returns the text string "DEFG" (the specified sub-string).


static void subStr(Args _args)
{
str s;
real r;
;
r = strLen("jitendraknit@gmail.com");
s = subStr("jitendraknit@gmail.com",12, 2);


print(strFmt("s=%1 and r=%2",s,r));
pause;
}


String Comparison in X++


static void strCmp(Args _args)
{
int i=2;
str s1,s2;
;
s1="string 1";
//s2="string 1";
s2="string 2";
i = strCmp(s1,s2);
if (0 == i)
{
print "s1 and s2 are the same";
}
else
{
print "s1 and s2 are different";
}
pause;
}




String Deletion in X++
static void strDel(Args _args)
{
str s;
;
s = strDel("Jitendrakumar", 5, 2);
print s;
pause;//for cut the string size first give from where it will cut thn give till thn it will cut
}



Find characters in string in X++
static void strFind(Args _args)
{
int i;
;
i = strfind("jitendrakumar", "jit", 0, 3);
if (1 == i)
{
print "Characters are found in string";
}
else
{
print "Characters are NOT found in string";
}
pause;
}
Strfmt()in X++
static void strfmt(Args _args)
{
str s1 ="testing";
int s2 = 2;
real s3 =4.56;
str s;
;
s = strfmt("string =%1,Integer = %2, Real = %3, ", s1,s2,s3);
print s;
pause;
}


Length of string in X++
// It will return no. of characters in given string
static void strLen(Args _args)
{
int i;
;
i = strLen("jitendra");
print(strFmt("i=%1",i));
pause;
}


Convert string in lower case in X++


static void strLwr(Args _args)
{
str l;
;
l = strLwr("JITENDRA");
print(strFmt("l=%1",l));
pause;
}


Convert string in upper case in X++
static void strUpr(Args _args)
{
str u;
;
u= strUpr("jitendra");
print(strFmt("u=%1",u));
pause;
}


Repetition of string in X++


static void strRep(Args _args)
{
str r;
;
r = strRep("xyz ", 5);
print(strFmt("r=%1",r));
pause;
}


Convert date into string in x++
// we can get date according to own format
static void systemDateGet(Args _args)
{
date d;
str d1,d2,d3 ;
;
d = systemdateget();
d1 = date2str(d,123,2,-1,2,-1,4);
d2 = date2str(d,231,2,-1,2,-1,2);
d3 = date2str(d,321,2,-1,2,-1,4);

print(strFmt("dates are %1,%2,%3,%4",d,d1,d2,d3));
pause;
}



Truncate Real value in X++
// will round off all digit after decimal(.)
static void trunc(Args _args)
{
real t;
;
t = trunc(4.6789);
print strfmt("t = %1", t);
pause;
}

Creation of Dialog in X++
static void dialogTest(Args _args)
{
Dialog dialog;
DialogGroup dialogGroup;
DialogField dialogField;
;
dialog = new Dialog("Test Dialog");
dialogGroup = dialog.addGroup("Customer Details");
dialogField = dialog.addField(extendedTypeStr(Custaccount),"Account Number");
dialog.run();
}




Create box for prompt in X++

static void boxExample(Args _args)
{


if(box::yesNo("Are u sure to close this form",dialogbutton::No,"Box Title")==dialogbutton::yes)
{
print("Closing.......");
pause;
}
else
{
print("Not closing......");
pause;
}


}

Container Operation in X++
// conins to insert into container
// conLen() for the size of the container
// conPeek() to get contents of container item
// conNull() to Assign null value
static void conpeek(Args _args)
{
container c;
int i;
;
c=conNull();
c =["item1", "item2","jit"];
c= conIns(c,2,"test");
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 8pt;"><span style="color: orange;"> for (i = 1 ; i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 12.09.2012, 11:54   #2  
MikeR is offline
MikeR
MCT
Аватар для MikeR
MCBMSS
Лучший по профессии 2015
Лучший по профессии 2014
 
1,628 / 627 (24) +++++++
Регистрация: 28.11.2005
Адрес: просто землянин
Очередной кумар начал изучать аксапту и решил поделиться значимыми для него событиями.
__________________
Axapta book for developer
Старый 12.09.2012, 18:42   #3  
Link is offline
Link
Британский учённый
Аватар для Link
Соотечественники
 
568 / 523 (19) +++++++
Регистрация: 25.11.2005
Адрес: UK
Записей в блоге: 9
Старался человек, вон какая у него подсветка кода, обзавидуешься
__________________
Людям физического труда для восстановления своих сил нужен 7-8 часовой ночной сон. Людям умственного труда нужно спать часов 9-10. Ну а программистов будить нельзя вообще.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
emeadaxsupport: List of fixes that improve performance of certain features in Dynamics AX 2009 Blog bot DAX Blogs 0 13.10.2009 19:06
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 02:12.