static void StringSplitter(Args _args)
{
GeneralJournalAccountEntry generalJournalAccountEntry;
TextBuffer buffer;
str value;
Counter cnt;
value = "1000-524-457-524";
//select generalJournalAccountEntry;
buffer = new TextBuffer();
buffer.setText(value);//generalJournalAccountEntry.LedgerAccount);
while (buffer.nextToken(0, '-'))
{
cnt++;
if(cnt == 1)
info (strFmt("first %1",buffer.token()));
if(cnt == 2)
info (strFmt("two %1",buffer.token()));
if(cnt == 3)
info (strFmt("three %1",buffer.token()));
if(cnt == 4)
info (strFmt("four %1",buffer.token()));
}
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
28 March 2014
How to get Ledger dimension values individually in AX 2012
static void IndividualDimensionValuesUsingView(Args _args)
{
GeneralJournalAccountEntry generalJournalAccountEntry; //Table that stores ledger transactions
DimensionAttributeLevelValueAllView dimAttrView; //View that will display all values for ledger dimensions
DimensionAttribute dimAttr; //Main dimension attribute table
int i;
setPrefix("Ledger dimension breakup");
while select generalJournalAccountEntry
{
i++;
if (i > 100)
break;
setPrefix(int2str(i) + ". " + DimensionAttributeValueCombination::find(generalJournalAccountEntry.LedgerDimension).DisplayValue);
while select DisplayValue from dimAttrView
where dimAttrView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension
join BackingEntityType from dimAttr
where dimAttr.RecId == dimAttrView.DimensionAttribute
{
switch (dimAttr.BackingEntityType)
{
case tableNum(DimAttributeMainAccount):
info(strFmt("Main Account: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeOMBusinessUnit):
info(strFmt("Business Unit: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeCustTable):
info(strFmt("Customer: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeOMDepartment):
info(strFmt("Department: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeHcmWorker):
info(strFmt("Worker: %1", dimAttrView.DisplayValue));
break;
}
}
}
}
{
GeneralJournalAccountEntry generalJournalAccountEntry; //Table that stores ledger transactions
DimensionAttributeLevelValueAllView dimAttrView; //View that will display all values for ledger dimensions
DimensionAttribute dimAttr; //Main dimension attribute table
int i;
setPrefix("Ledger dimension breakup");
while select generalJournalAccountEntry
{
i++;
if (i > 100)
break;
setPrefix(int2str(i) + ". " + DimensionAttributeValueCombination::find(generalJournalAccountEntry.LedgerDimension).DisplayValue);
while select DisplayValue from dimAttrView
where dimAttrView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension
join BackingEntityType from dimAttr
where dimAttr.RecId == dimAttrView.DimensionAttribute
{
switch (dimAttr.BackingEntityType)
{
case tableNum(DimAttributeMainAccount):
info(strFmt("Main Account: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeOMBusinessUnit):
info(strFmt("Business Unit: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeCustTable):
info(strFmt("Customer: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeOMDepartment):
info(strFmt("Department: %1", dimAttrView.DisplayValue));
break;
case tableNum(DimAttributeHcmWorker):
info(strFmt("Worker: %1", dimAttrView.DisplayValue));
break;
}
}
}
}
24 March 2014
14 March 2014
Set query Range for Existing report in while running in class PrintMedium settings for Report in class
Method()
{
Args args;
ReportRun reportRun;
str reportName = "ReportNameTest";
str myPath;
int i;
TransDate td;
TransDate vd;
str rangeDate;
;
i = 1;
td = systemDateget();
args = new Args(reportName);
args.caller(reportRun);
reportRun = new reportRun(args);
reportRun.query().interactive(false);
reportRun.query().dataSourceTable(tablenum(TableNmae)).addRange(fieldNum(TableNmae,FeildNmae)).value(SysQuery::value(td));
reportRun.report().interactive(false);
reportRun.setTarget(printMedium::File);
reportRun.printJobSettings().setTarget(PrintMedium::File);
reportRun.printJobSettings().preferredTarget(PrintMedium::File);
reportRun.printJobSettings().format(PrintFormat::PDF);
reportRun.printJobSettings().warnIfFileExists(false);
reportRun.printJobSettings().suppressScalingMessage(true);
pdfFileName = @"\\AXTESTDEV1\D$\Demo\Test.pdf";
reportRun.printJobSettings().fileName(pdfFileName);
reportRun.init();
reportRun.run();
}
{
Args args;
ReportRun reportRun;
str reportName = "ReportNameTest";
str myPath;
int i;
TransDate td;
TransDate vd;
str rangeDate;
;
i = 1;
td = systemDateget();
args = new Args(reportName);
args.caller(reportRun);
reportRun = new reportRun(args);
reportRun.query().interactive(false);
reportRun.query().dataSourceTable(tablenum(TableNmae)).addRange(fieldNum(TableNmae,FeildNmae)).value(SysQuery::value(td));
reportRun.report().interactive(false);
reportRun.setTarget(printMedium::File);
reportRun.printJobSettings().setTarget(PrintMedium::File);
reportRun.printJobSettings().preferredTarget(PrintMedium::File);
reportRun.printJobSettings().format(PrintFormat::PDF);
reportRun.printJobSettings().warnIfFileExists(false);
reportRun.printJobSettings().suppressScalingMessage(true);
pdfFileName = @"\\AXTESTDEV1\D$\Demo\Test.pdf";
reportRun.printJobSettings().fileName(pdfFileName);
reportRun.init();
reportRun.run();
}
06 March 2014
AX 2012 SSRS RDP Class
[SRSReportQueryAttribute(querystr(CustTransQuery))]
public class CustTransdemoDP extends SRSReportDataProviderBase
{
CustTransDemoTmp custTransDemoTmp;
CustTable custTable;
CustTrans custTrans;
AmountCur amountCur;
Voucher voucher;
CustGroupId custGroup;
TransDate transDate;
}
=================
[SRSReportDataSetAttribute(tableStr(CustTransDemoTmp))]
private CustTransDemoTmp getCustTransTmp()
{
select custTransDemoTmp;
return custTransDemoTmp;
}
======================
private void inserrtIntoCustTransTmp()
{
custTransDemoTmp.CustGroup = custTable.CustGroup;
custTransDemoTmp.AmountCur = custTrans.AmountCur;
custTransDemoTmp.Voucher = custTrans.Voucher;
custTransDemoTmp.TransDate = custTrans.TransDate;
custTransDemoTmp.insert();
}
=======================
[SysEntryPointAttribute]
public void processReport()
{
QueryRun queryRun;
queryRun = new QueryRun(this.parmQuery());
while (queryRun.next())
{
custTable = queryRun.get(tablenum(CustTable));
custTrans = queryRun.get(tablenum(CustTrans));
amountCur = custTrans.AmountCur;
voucher = custTrans.Voucher;
custGroup = custTable.CustGroup;
transDate = custTrans.TransDate;
this.inserrtIntoCustTransTmp();
}
}
public class CustTransdemoDP extends SRSReportDataProviderBase
{
CustTransDemoTmp custTransDemoTmp;
CustTable custTable;
CustTrans custTrans;
AmountCur amountCur;
Voucher voucher;
CustGroupId custGroup;
TransDate transDate;
}
=================
[SRSReportDataSetAttribute(tableStr(CustTransDemoTmp))]
private CustTransDemoTmp getCustTransTmp()
{
select custTransDemoTmp;
return custTransDemoTmp;
}
======================
private void inserrtIntoCustTransTmp()
{
custTransDemoTmp.CustGroup = custTable.CustGroup;
custTransDemoTmp.AmountCur = custTrans.AmountCur;
custTransDemoTmp.Voucher = custTrans.Voucher;
custTransDemoTmp.TransDate = custTrans.TransDate;
custTransDemoTmp.insert();
}
=======================
[SysEntryPointAttribute]
public void processReport()
{
QueryRun queryRun;
queryRun = new QueryRun(this.parmQuery());
while (queryRun.next())
{
custTable = queryRun.get(tablenum(CustTable));
custTrans = queryRun.get(tablenum(CustTrans));
amountCur = custTrans.AmountCur;
voucher = custTrans.Voucher;
custGroup = custTable.CustGroup;
transDate = custTrans.TransDate;
this.inserrtIntoCustTransTmp();
}
}
Subscribe to:
Posts (Atom)
Ledger Voucher creation Framework and x++ code to create ledger voucher
Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...