Eduardo
2010-09-14 18:12:03 UTC
Hi,
I have a requirement that says I need to allow the user to print a Purchase
Order by clicking a button in an external application. Regarding this,
everything related to the communication between AX and the app is out of the
scope of this question. I just need to know if there is a way to do this by
code (Print PO)
I have afound an article online
(https://community.dynamics.com/blogs/axsantoshkumar/archive/2010/05/04/displaying-the-standard-ax-report-in-ep-pages-of-ax.aspx)
The problem is that this article only shows how to print based on a simple
report such as Cust (in reports). I have modified the code for the example
(changed the report name to PurchPurchaseOrder) and I added a parameter.
I encounter an error here:
protected void initQuery()
{
;
//Change the Query by adding filters to the Report Query
//reportName = PurchPurchaseOrder
report = new Report(reportName);
// get the Report Query def into query obj.
query = new Query(report.query());
//passing the value - HERE IS THE ERROR
query.dataSourceTable(tableNum(PurchTable)).rangeField(fieldNum(PurchTable,
PurchId)).value(purchId);
}
The errors says that the QueryBuild Object has not been initialized, but I
have here:
class PurchLineDetails_PrintPurchaseOrder
{
Args reportArgs;
ReportName reportName;
ReportRun reportRun;
Report report;
PrintJobSettings printJobSettings;
Query query; HERE I INITIALIZED THE query VALUE
PurchId purchId;
}
The other problem is that when the code into the reportRun.init(), it alwats
goes into the statement !journalList as shown below
if (element.args().record())
journalList =
FormLetter::createJournalListCopy(element.args().record());
else
journalList = element.args().object();
if (!journalList) IT ALWAYS COME HERE
throw '';
What does this mean?
I know it is a lot, but any help or thought will be greatly appreciated.
Thanks a lot!
Eduardo
I have a requirement that says I need to allow the user to print a Purchase
Order by clicking a button in an external application. Regarding this,
everything related to the communication between AX and the app is out of the
scope of this question. I just need to know if there is a way to do this by
code (Print PO)
I have afound an article online
(https://community.dynamics.com/blogs/axsantoshkumar/archive/2010/05/04/displaying-the-standard-ax-report-in-ep-pages-of-ax.aspx)
The problem is that this article only shows how to print based on a simple
report such as Cust (in reports). I have modified the code for the example
(changed the report name to PurchPurchaseOrder) and I added a parameter.
I encounter an error here:
protected void initQuery()
{
;
//Change the Query by adding filters to the Report Query
//reportName = PurchPurchaseOrder
report = new Report(reportName);
// get the Report Query def into query obj.
query = new Query(report.query());
//passing the value - HERE IS THE ERROR
query.dataSourceTable(tableNum(PurchTable)).rangeField(fieldNum(PurchTable,
PurchId)).value(purchId);
}
The errors says that the QueryBuild Object has not been initialized, but I
have here:
class PurchLineDetails_PrintPurchaseOrder
{
Args reportArgs;
ReportName reportName;
ReportRun reportRun;
Report report;
PrintJobSettings printJobSettings;
Query query; HERE I INITIALIZED THE query VALUE
PurchId purchId;
}
The other problem is that when the code into the reportRun.init(), it alwats
goes into the statement !journalList as shown below
if (element.args().record())
journalList =
FormLetter::createJournalListCopy(element.args().record());
else
journalList = element.args().object();
if (!journalList) IT ALWAYS COME HERE
throw '';
What does this mean?
I know it is a lot, but any help or thought will be greatly appreciated.
Thanks a lot!
Eduardo