Skip to main content

Posts

Showing posts with the label find string

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 = strnfind("test", "s", 3, 4);   print "i = " + int2str(i); scan string from string using strscan int i;   ;   i

strscan function to scan string characters in axapta

This is a sample of code how to use of strscan function in axapta to scan string from string. void ArrayAccount() { //s = ""; // len = strlen( _s ); // pos = strfind( _s, _delimeter, len, -len ); // s = strdel( _s, 0, pos ); cntAc =1; name = System.Convert::ToString(BHead); Accountname[cntAc] = LedgerTable::find(name).AccountName; len = strlen(name); for (i = 0; i<=len;i++) { pos = strscan( name, ".", strlen( name ), 0 - strlen( name ) ); fName = strdel( name, pos, strlen( name ) - pos + 1 ); lastName = strdel( name, 1, pos ); if (FName != "") { name = fName; cntAc++; Accountname[cntAc] = LedgerTable::find(name).AccountName; } } }