Search This Blog

Saturday, 21 June 2014

Installation and Configuration of SSAS and SSRS in AX 2012

Hi Guys,

I have gone through a wonderful blog , where they have described about the SSAS, SSRS installation and configuration in AX 2012

click here for SSAS installation

click here for SSRS and SSAS installation

Happy Daxing.....

Saturday, 14 June 2014

Creating a New Sales order by copying existing Sales Order headers and lines in AX 2012

Hi Guys,

Today I am going to explain you , how to copy a existing sales order header and lines and create a new Sales Order.

Step 1:

Add two new control in Form level Design

1) SelectFromExistingSalesId (ControlType-CheckBox)
2)ExistingSalesId(ControlType-StingEdit)



Step 2:
Write a single line of code inside From Level init() method
ExistingSalesId.enabled(false);//Make the ExistingSalesId control Disable when the form open

Step 3:
write a piece of code inside SelectFromExistingSalesId checkbox Control modified() method




public boolean modified()
{
boolean ret;
ret = super();

if(SelectFromExisitngSalesId.value()==1)
{
   ExistingSalesId.enabled(true);
}
else
{
  ExistingSalesId.enabled(false);
}
return ret;

}
Step 4:
create a new method CreateSalesLines in the form level
 
 

public void createSalesLine(SalesId _salesId,ItemId _itemId)
{
SalesLine salesLine;
salesLine.clear();

salesLine.SalesId = _salesId;
salesLine.ItemId = _itemId;

salesLine.createLine(NoYes::Yes, // Validate
NoYes::Yes, // initFromSalesTable
NoYes::Yes, // initFromInventTable
NoYes::Yes, // calcInventQty
NoYes::Yes, // searchMarkup
NoYes::Yes);
}

Step 5:
write a piece of code inside ExistingSalesId Control modified() method

 
public boolean modified()
{
SalesTable salesTableBuff;
SalesLine salesLineBuff;
ItemId existItemId;
SalesId currentSalesId;
SalesIdBase existSalesId;

boolean ret;
ret = super();

existSalesId=ExistingSalesId.valueStr();//Gets the Existing Sales Id

select firstOnly SalesId,CustAccount from salesTableBuff

where salesTableBuff.SalesId == existSalesId;

SalesTable.CustAccount = salesTableBuff.CustAccount;

currentSalesId= SalesTable.SalesId; //Gets the Newly generated Sales Id

SalesTable_ds.object(fieldNum(SalesTable,CustAccount)).modified();

SalesTable.insert();

while select ItemId from salesLineBuff where salesLineBuff.SalesId == existSalesId
{

   existItemId=salesLineBuff.ItemId;
   element.createSalesLine(currentSalesId, existItemId);

}

return ret;

}

Output:
 
A New Sales Oder is Created
 
 


That's it ........

Happy Daxing....



Passing Arguments from One Form to Another Form in AX 2012

Hi Guys,

Today I would like to share you how to pass arguments from one form to another form in AX 2012

Create Two New Table and Two New Form

For an example , I have created two new Table and two new Form

Table 1: SheetTable

 

Table 2:SheetDetails



Form 1 :SheetTable , Datasource Name : SheetTable

Create Ok Button in SheeTable Form


Write a piece of logic in the clicked method



void clicked()
{
Args args;
FormRun formRun;
super();
args = new args();
args.parm(SheetTable.SheetId);

args.record(SheetTable);
args.name( formstr( SheetDetails ) );

formRun = classFactory.formRunClass( Args );
formRun.init();
formrun.run();
formrun.wait();

}
Form 2: SheetDetails , DataSource Name : SheetDetails
 
 
write a piece of code in Form level init() method
public void init()
{
Query query;
QueryBuildRange qbr;
SheetTable _sheetTable;
SheetDetails sheetDetails1;
Str _parmid;
super();
_sheetTable = element.args().record();
_parmid= element.args().parm();
query= new Query();
qbr=query.addDataSource(tableNum(SheetDetails)).addRange(fieldNum(SheetDetails,SheetId));
qbr.value(_parmid);
SheetDetails_ds.query(query);
}
 
Output:
That's it ..........We have done it


Happy Daxing........