Tuesday, September 27, 2016

Call SSRS Repart class and Table data through Job in Ax 2012

To SSRS Repart class and Table data through Job in Ax 2012 you can try below code.


   TestTmp tempTable;  
   TestDP dataProvider = new TestDP();  
   TestContract contract = new TestContract();  
   contract.parmCustAccount("Test00001");  
   contract.parmNofSample(8);  
   dataProvider.parmDataContract(contract);  
   dataProvider.processReport();  
   tempTable = dataProvider.getTestTmp();  
   while select tempTable  
   {  
     info(strFmt("%1,%2,%3,%4",tempTable.CurrencyCode,tempTable.SalesId,tempTable.Monthname,tempTable.CurrentMonthSum));  
   }  

Here TestDP is data provider class for SSRS Report and TestContract is contract class . To pass parameter value we used parmCustAccount and parmNofSample method from contract class. tempTable is temparary table used in DP class.

How to concatenate string and Upper case in Axapta

To concatenate string and Upper case in Axapta you can try below code

   str a = 'test',b = 'car',d1 = 'speed';  
   str c;  
   str d,e;  
   ;  
   c = a + b + d1;  
   d = curext();  
   info(c);  
   info(strUpr(d));  

Monday, September 26, 2016

How to get Country Name by Country code for Sales order in Ax 2012

To  get Country Name by Country code for Sales order in Ax 2012 you can try below code.


 LogisticsAddressCountryRegionTranslation::find  
 (LogisticsPostalAddress::findRecId  
 (salesTable.DeliveryPostalAddress).CountryRegionId,'EN-US').ShortName  

Like code is SAU then if you want to display name of SAU as Saudi Arabia then you need to find it from LogisticsAddressCountryRegionTranslation table.

Thursday, September 8, 2016

Hide dialog for SSRS Report in ax 2012

To Hide dialog for SSRS Report in ax 2012 you need to go to controller class and follow below steps.

Go to Controller class then go to  main method of class.

Find  statement : Controller.startOperation(); then specify the below statement to hide dialog box which used for range selection.

Controller.parmShowDialog(false);

To show dialog you can pass value true instead of false.

Tuesday, September 6, 2016

Code to call Display method in Workflow class in Ax 2012

If you want to show display method of table in workflow designer then you need to write method on table and class .

For example table method to get customer credit limit value.

 display AmountMST Cust_CreditLimit()  
 {  
   ;  
   return CustTable::find(this.CustAccount).CreditMax;  
 }  

Then go to document class for e.j. \Classes\PurchTableDocument and create new method like this.


 public AmountMSTParmCreditLimit(CompanyId _companyId, TableId _tableId, RecId _recId)  
 {  
   CustTable CustTable;  
   select CustTable where CustTable.recid==_recId;  
   return CustTable.Cust_CreditLimit();  
 }