1.Queries in Jobs
static void Query_Ex(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
SalesTable salesTable;;
q = new Query();
qbd = q.addDataSource(TableNum(salesTable));
qbr = qbd.addRange(FieldNum(salesTable,SalesId));
qbr.value("00078_036");
qr = new QueryRun(q);
while(qr.next())
{
SalesTable = qr.get(TableNum(salesTable));
info(salesTable.CustAccount);
}
}
---------------------------
2.Queries in Reports
In Report -> Fetch Method write the following code for Range
public boolean fetch()
{
boolean ret;
Query q;
QueryRun qr;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
SalesTable salesTable;;
//ret = super();
q = new Query();
qbd = q.addDataSource(TableNum(salesTable));
qbr = qbd.addRange(FieldNum(salesTable,SalesId));
qbr.value("00078_036");//range value
qr = new QueryRun(q);
while(qr.next())
{
SalesTable = qr.get(TableNum(salesTable));
this.send(salesTable);
}
return true;
}
-----
Code for with out range
public boolean fetch()
{
boolean ret;
Query q;
QueryRun qr;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
SalesTable salesTable;;
//ret = super();
q = new Query();
qbd = q.addDataSource(TableNum(salesTable));
qr = new QueryRun(q);
while(qr.next())
{
SalesTable = qr.get(TableNum(salesTable));
this.send(salesTable);
}
return true;
}
-------
Query Run with DS
DataSource added in report SalesTable
Report->Fetch()
public boolean fetch()
{
boolean ret;
QueryRun qr = new QueryRun(this);
;
//ret = super();
while(qr.next())
{
SalesTable = qr.getNo(1);// 1 refer the 1st datasource.
this.send(SalesTable );
}
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.
Subscribe to:
Post Comments (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...
No comments:
Post a Comment
Give me the commetns and solutions