Displaying PO number on purchrequistionsListpage

Hello,

I got a requirement like I have to display the PO number On purchase requistions listpage,so when i am trying to add a purchreqLine table to the listpage query and pulling the Purch id from PurchReqLine table,its pulling the multiple records on listpage if purchRequistion has multiple lines. How can I pull only one record from the requistions which has multiple lines.

thank you.

Of course you get multiple records, if you have multiple lines. It should be obvious.

The question is: which line does contain the order ID you want to display? Don’t forget that there may be more than one and you have to define which one you want to get. For example, you may want to see the highest order ID.

Hello Martin,

Thank you for your quick reply. Actually I would like to display the PO number for each requistion which ever has the PO,but it should not repeat for the requistions which has multiple lines. I think you got my point.

Thanks again!!

No, you didn’t get my point. Let’s say your requisition R1 was used for creating two purchase orders: PO1 and PO2.

Which one do you want to see in the list page? PO1 or PO2? Based on what decision? Or maybe you want to display something else, such as text “”.

got you. Actually my client will create only one PO from one requisition all the time. So here one requisition will have only one PO. So how can I display that PO number on listpage?

It doesn’t really matter - you still have to pick one order ID by some logic, even if you say that it doesn’t matter and you simply pick a random one.

You can follow my suggestion and take the highest order ID. Add a display method to PurchReqTable, like this:

display PurchId highestPurchId()
{
    PurchReqLine line;

    select maxOf(PurchId) from line
        where line.PurchReqTable == this.RecId;

    return line.PurchId;
}

Then use the display method in the form (and make sure it’s cached).

Hi Martin,

your solution fixed my problem. Thank you so much :slight_smile:

In that case, please mark my reply as the verified solution. It will make clear that the question has been answered and others will be able to easily locate the answer.