Error related to Report in Ax

Hi All,

While making report I got stucked into a small issue for not getting any solution for it. Can anyone help me for solving this issue.

Firstly I want to select the maximum purchase Order Id from the table VendPurchOrderJour.

1586.Capturejour.PNG

And after getting the max purchaseorde id for the same Purch Id ,I want to select all the items related to this max purchaseOrderId from the table VendPurchseOrderTrans.3487.CaptureTrans.PNG

For this I have also written code which is correctly running in job but not giving correct output in report as only returning the last value.

Can anybody guide me the correct solution for it.

Hi Abhishek,

First of all, i just want make one thing clear… What do you exactly mean the max of Purchase order ID?

  1. The PO ID which has maximun lines or

  2. The PO ID ie there are records from 0000001_070 - 0000090_070 and you want the record 0000090_070 as 90 is the maximum number

Like this we can create many scenarios for maximum of PO ID.

Pls make sure that your requirement should be exact and understandable so that anyone can guide you easily… :slight_smile:

Thanks and regards,

Kevin

Hi Enrique,

Thanx Enrique for the reply.Actually what I want to do is : I have to show in the report only those items which is get posted recently .And I can collect it from VendPurchOrderJour which has been here as 00000011_070 when i am selecting for the purch id 00000062_069.

After getting the max Purchase Order Id from table VendPurchOrderJour .I want to select only those items from the table VendPurchOrderTrans whose PurchaseOrderId==00000011_070

1538.Captureitems.PNG

I want to show the items from 1.01 to 141.O1 i.e last 12 items in the report .How i can do this?

Hi Abishek,

You can use like this na…

Select MaxOf(PurchID) from VendPurchOrderJour; – this will take the max purchid

{

while select VendPurchOrderTrans where VendPurchOrderTrans .PurchID == VendPurchOrderJour.purchid

{

this.send(VendPurchOrderTrans);

}

}

Thanks and Regards,

Kevin

while select itemid from vendpurchordertrans where vendPurchOrderTrans.purchOrderId in

( while select max(purchOrderId) vendpurchorderjour vendPurchOrderJour.purchOrderId== “0000062_69”)

{

s=vendpurchpurchOrderTrans.ItemId;

return s;

}

}

may be its helpful for u

Hello Enrique & Mahesh

The method which I have posted in the question is running correctly in the job and all the items are getting printed on the screen but when I use the same method in the report it not showing all the items,only it is returning the first value .

The method u have written is same as the the one I have tried but the items are not getting printed on the report.

Thank You

Abhishek

Hi Abishek,

Can u post the complete code which u have used in your fetch method… See, put a debugger and check what is happening and what is the execution flow. So u can able to find why only the first item in printed and why it is not goin to the next item…

Thanks and Regards,

Kevin

Hi Abhishek,

I hope the issue is with the display method.Bcoz display method returns only one value.

Hi Jyothi,

Can you suggest any solution to solve this problem?

Thank You

Abhishek Bhati

Hi Abhishek,

Just i suggest u ,try to execute the fetch() of ur report ,on ur query basis only

Hi Enrique ,

Here I am with the fetch method

public boolean fetch()

{

boolean ret;

printPageFooter = false;

this.query().dataSourceTable(tablenum(VendPurchOrderTrans)).addRange(fieldnum(VendPurchOrderTrans,purchId)).value(queryvalue(dlgf.value()));

ret = super();

printPageFooter = true;

return ret;

}

Hi,

How can you run a report with display method… As jyothi says, it will return only one value means, one cycle of data. Fetch method is the right method to code for a report in the case the requirement u needs. thats y i asked you what code u have written in ur fetch method. Every cycle, if u need the display data which is not in your datasource, at that time, create a temp buffer or variable, store the data and display that data in display method.

Hi,

U can try with the code below in fetch method which will help you…Comment your code and try this

public boolean fetch()

{

VendPurchOrderJour VendPurchOrderJour;

VendPurchOrderTrans VendPurchOrderTrans;

;

Select MaxOf(PurchID) from VendPurchOrderJour;

{

while select VendPurchOrderTrans where VendPurchOrderTrans .PurchID == VendPurchOrderJour.purchid

{

this.send(VendPurchOrderTrans);

}

}

return true;

}