Skip to main content

Posts

Display data of particular division and circles and filter data separated by comma

Display data of particular division and circles and filter data separated by comma public void UserRigths() { currentUserId = curUserId(); select * from sysCompanyUserInfo where sysCompanyUserInfo.UserId == currentUserID; if(sysCompanyUserInfo) { if(sysCompanyUserInfo.EmplId != "") { while select * from EmplTable2 where EmplTable2.EmplId == sysCompanyUserInfo.EmplId { d1 = System.Convert::ToString(EmplTable2.Dimension[2]); } if(d1 != "") { while select * from _OrganizationChart2_1 where _OrganizationChart2_1.WareHouseCode == d1 { _Office_type = _OrganizationChart2_1.Office_type; } } if (d1 != "") { if ((enum2str(_Office_type) == "Sachivalaya") || (enum2str(_Office_type) == "CE") || (enum2str(_Office_type) == "Circle") ) { while select * from _OrganizationChart2_2 where _OrganizationChart2_2.ParentWareHouseCode == d1 { OfficeName += _OrganizationC

Delete_from command to delete from table in axapta

As with the insert_recordset and update_recordset operators, there is also an option for deleting a chunk of records. This operator is called delete_from and is used as the next example shows: static void Delete_FromExample(Args _args) { CarTable carTable; ; delete_from carTable where carTable.Mileage == 0; }

Get current financial year from date and To date in axapta

public str getFinyear_To() { yy= 0; mm =0; mm3=""; DtFrm = todt; strdtfrm = date2str(todt, 123, 2, 4, 2, 4, 4); mm = str2int(substr(strdtfrm, 4, 2)); yy = str2int(substr(strdtfrm, 7, 4)); yy5 = str2int(substr(strdtfrm, 7, 4)); mm3 = substr(strdtfrm, 4, 2); if (mm <= 4) { yy--; } finYrTo = int2str(yy) + '-';  yy++; finYrTo += substr(int2str(yy),3,2); return finYrTo; }  public str getFinyear_From() { ; DtFrm = frmdt;  strdtfrm = date2str(dtfrm, 123, 2, 4, 2, 4, 4); mm = str2int(substr(strdtfrm, 4, 2)); yy = str2int(substr(strdtfrm, 7, 4)); mm2= substr(strdtfrm, 4, 2); yy4 = str2int(substr(strdtfrm, 7, 4));  if (mm <= 3) { yy--; }  finYrFrom = int2str(yy) + '-';  yy++; finYrFrom += substr(int2str(yy),3,2); return finYrFrom; } 

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; }

Binding user to particular office in axapta application

This is simple filter code for Binding  user to particular office in axapta application. Like current user is adam and you want to show him only one employee date then you can use filter methodology this way. public void filter1() { UserId currentUserId; SysCompanyUserInfo sysCompanyUserInfo; _ServiceDetails2 _ServiceDetails2; EmplTable emplTable; InventLocationId inventLoc; Date LastDate; RecId RecId; currentUserId = curUserId(); select * from sysCompanyUserInfo where sysCompanyUserInfo.UserId == currentUserID; if(sysCompanyUserInfo) { if(sysCompanyUserInfo.EmplId != "") { select * from emplTable where emplTable.EmplId == sysCompanyUserInfo.EmplId; if(emplTable) { if(emplTable.EmplId != "") { while select * from _ServiceDetails2 where _ServiceDetails2.EmplId == emplTable.EmplId { if(LastDate == any2date(0)) { LastDate = _ServiceDetails2.DateTo; RecId = _ServiceDetails2.RecId; } else { if(LastDate < _ServiceDetails2.DateTo) { L

Insert and delete item from container in Axapta

This is a sample of code how to Insert and delete item from container in Axapta. This code you can apply in form or report for your purpose. static void Datatypes_container_functions(Args _args) { container con; ; // conins - Insert values to the container con = conins(con, 1, "Toyota"); con = conins(con, 2, 20); con = conins(con, 3, 2200.20); con = conins(con, 4, "BMW"); con = conins(con, 5, 12); con = conins(con, 6, 3210.44); // condel - Delete the third and the fourth element // from the container con = condel(con, 3, 2); // conpeek - Read values from the container info(conpeek(con,1)); info(conpeek(con,2)); info(conpeek(con,3)); info(conpeek(con,4)); // connull - Reset the container con = connull(); // conlen - Get the length of the container info(strfmt("Length: %1",conlen(con))); }