Skip to main content

Posts

Showing posts with the label String Manipulation

strScan and Find a first occurrence of a string in a string using x++

strScan (Find a first occurrence of a string in a string) info("int strScan(str _text1,str _text2,int _position,int _number)"); info("Searches a text string for the occurrence of another string."); info("_text1 - The text string to search."); info("_text2 - The string to find."); info("_position - The position at which the search should start."); info("_number - The number of characters that should be searched."); info(int2str(strScan("ABCDEFGHIJ","DE",1,10)));

Find a first occurrence of a character in a string in reverse in MSD axapta x++

strNFind  (Find a first occurrence of a character in a string in reverse) info("int strNFind(str _text,str _characters,int _position,int _number)"); info("Searches a portion of a text string for the first occurrence of a character that is not included in a specified list of characters."); info("_text - The text string to search."); info("_characters - The list of characters to exclude from the search."); info("_position - The position in the string that the search should start at."); info("_number - The number of characters to search."); info("strNFind(\"ABCDE\",\"ABCE\",1,5) " + int2str(strNFind("ABCDE","ABCE",1,strLen("ABCDE"))));

Converts string to lowercase in axapta x++ language MSDAX

To Converts all letters in a text string to lowercase in axapta x++ language You can try following code in job. I hope this can be helpful for you for string manipulation programs. strLwr (String Lower) info("str strLwr(str _text)"); info("Converts all letters in a text string to lower case."); info("strLwr(\"ABcd123xYZ\") " + strLwr("ABcd123xYZ"));

Send and recieve parameter string by args in MSD axapta

Send and recieve parameter string through args in axapta 1. Send void clicked() { Args args = new Args(); ; Args.parm("retrive hell"); new MenuFunction(menuitemdisplaystr(abc_Param_String_Recieve), MenuItemType::Display).run(args); } 2. Receive public void init() { // super(); str paramString; Args args; ; super(); args = new args(); paramString = element.args().parm(); info(strfmt("paramString = %1",paramString)); }

Some important function which used in axapta

Get current user id str s;   ;   s = curuserid();   print "Current user ID is " + s;   pause; Field id to field Name str name;   tableid _tableId;   fieldid _fieldid;   ;   _tableId = tablename2id("Address");   _fieldId = fieldname2id(_tableId, "Name");   name = fieldid2pname(_tableId, _fieldid);   print name;   pause; To get next month of given date   date d;       ;       d = nextmth(today()); //For example, NextMth(29\02\1996) returns the date '29\03\1996', but NextMth(31\01\1996) returns the date '29\02\1996' (leap year).       print "Next month is " + date2str(d, 2, 2, -1, 2, -1, 4);        pause; To delete string from string str s;   ;   s = strdel("TESTstring", 5, 6);   print s;   pause; Find string using strfind int i;   ;   i = strnf...

Get current financial year in axapta

display str CurFinYr() { DtFrm = frmdt; strdtfrm = date2str(dtfrm, 123, 2, 4, 2, 4, 4); yy = str2int(substr(strdtfrm, 7, 4)); Fyy = substr(int2str(yy),3,2); DtTo = toDt; strdtto = date2str(DtTo, 123, 2, 4, 2, 4, 4); yy = str2int(substr(strdtto, 7, 4)); Tyy = substr(int2str(yy),3,2); CurFinYr=Fyy+" - "+Tyy; return CurFinYr; }

Get previous financial year in axapta

By using this method you can Get previous financial year in axapta. If you are using from date and to date in ax and these date belongs to current financial year but your requirement is to get 1 year back financial year then you can use this method. Display str PrevFinYr() { str f,t; DtFrm = frmdt; strdtfrm = date2str(dtfrm, 123, 2, 4, 2, 4, 4); yy = str2int(substr(strdtfrm, 7, 4)); Fyy = substr(int2str(yy),3,2); DtTo = toDt; strdtto = date2str(DtTo, 123, 2, 4, 2, 4, 4); yy = str2int(substr(strdtto, 7, 4)); Tyy = substr(int2str(yy),3,2); if ((str2int(fyy)-1)<10) {  f="0"+int2str(str2int(fyy)-1);  }  else  { t=int2str(str2int(fyy)-1);  }  if ((str2int(tyy)-1)<10) { t="0"+int2str(str2int(tyy)-1); } else {  t=int2str(str2int(tyy)-1); }  PrevFinYr=f +" - "+ t; return PrevFinYr; }