web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How can I remove the duplicate values ??that are displayed after the join?

(0) ShareShare
ReportReport
Posted on by 106

I generate an excel file that has data from several tables, the problem is that when I join with InventTrans, duplicate values ​​are displayed. How could I avoid this?

Another problem is when I do the join with PDSAdvancedPriceInfo to retrieve the value from the CalculatedUnitPrice field. When I add the join, no result is displayed.

 while select purchTable
        where purchTable.OrderAccount==_dataContract.parmVendAccount() ||
              purchTable.VendGroup==_dataContract.parmVendGroup()
        && purchTable.DeliveryDate >= _dataContract.parmFromDate ()
        && purchTable.DeliveryDate <= _dataContract.parmToDate ()
        join logisticsPostalAddress
        where purchTable.DeliveryPostalAddress==logisticsPostalAddress.RecId
        join  purchLine
        where purchLine.PurchId==purchTable.PurchId
        //join pdsAdvancedPriceInf
        //where pdsAdvancedPriceInf.PurchLineRefRecId==purchLine.RecId
        join inventDim
        where purchLine.InventDimId==inventDim.inventDimId
        join inventTrans
        where inventTrans.inventDimId==inventDim.inventDimId

    {
    row  ;
    if (purchLine.PurchStatus==PurchStatus::Received || purchLine.PurchStatus==PurchStatus::Invoiced)
        {
           receivedStatus=PI_ReceivedStatus::FullyReceived;
           cell=cells.item(row,5);
           cell.value(enum2str(receivedStatus));
        }

       if(purchLine.PurchStatus!=PurchStatus::Received || purchLine.PurchStatus!=PurchStatus::Invoiced && inventTrans.StatusReceipt==StatusReceipt::Ordered)
        {  
           receivedStatus=PI_ReceivedStatus::ToBeReceived;
           cell=cells.item(row,5);
           cell.value(enum2str(receivedStatus));
        }
        
        //cell=cells.item(row,14);
       // cell.value(pdsAdvancedPriceInf.CalculatedUnitPrice);
    }

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: How can I remove the duplicate values ​​that are displayed after the join?

    Hi Pavel Ioana,

    You can use group by to avoid duplicate records. Also make use of the view - You can join all the tables to the view - On the view you can add group by and use that view for excel generation.

    Thanks,

    Girish S.

  • Martin Dráb Profile Picture
    236,320 Most Valuable Professional on at
    RE: How can I remove the duplicate values ​​that are displayed after the join?

    What you should depends on what result you want to get.

    I see that you're using InventTrans to check if StatusReceipt == Ordered. But what if there is one transaction Ordered and another in a different state? What do you want to do then?

  • Pavel Ioana Profile Picture
    106 on at
    RE: How can I remove the duplicate values ​​that are displayed after the join?

    What I need to do is to create the Received Status field that will be populated with: Received status – this will be populated with:

    • Fully received - If the entire purchase order is received
    • Partially received – if some quantities from the PO is received but not fully received
    • To be received – if none of the quantity is yet receive

     I use InventTrans to verify each transaction

  • Martin Dráb Profile Picture
    236,320 Most Valuable Professional on at
    RE: How can I remove the duplicate values ​​that are displayed after the join?

    A join allows to link records, not to do a calculation like this. You either need a computed column, or you need another database query for each line to find transactions statuses.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,100

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 890 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 633 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans