How to get all shipments

Sometimes you’ll need to get a list of all shipments in the database and iterate through them. To do this, you’ll need to first get the ID of the parent node in your treeview, then pass the TradingPartnerID into the shipment list. Code snippet below.

        // Get root node (use your name here)
        TradingPartner tp = TradingPartner.GetTradingPartner("Fabrikam Staging");
        if (tp.Name == "Fabrikam Staging")
        {
            // Fetch all shipments in the database
            ShipmentList shipments = ShipmentList.GetShipmentList(tp.TradingPartnerID, ShipmentStatusType.ShowAll, false);

            Console.WriteLine(shipments.Count.ToString() + " found");
            foreach (ShipmentListItem ship in shipments)
            {
                Console.WriteLine(ship.ShipmentNumber);
            }
        }

When trying to use the above code for getting the shipments of the main branch the shipments collection is empty when the name of the branch ends with a dot “.”

Hello Marco. Can you send a database to our support team and a code snippet and we can take a look?

Thanks

Hello Marco. Hope this finds you doing well.

This was an odd one. So… The ‘TradingPartner’ under the hood is a base object for a lot of other objects, such as the stocking location, customer, and vendor.

In your case you want to retrieve the branch office with the name “Safe B.V.”, but there’s also a customer and vendor named “Safe B.V.”. The fetch simply grabs the first one, which happens to be the vendor in your case. You can see this by observing this property after the trading partner is fetched:

tp.TradingPartnerType

There’s an overload on the GetTradingPartner that accepts a type, but unfortunately it looks like it’s not working properly.

Until we can get this fixed, can you change your branch office name to something unique, like “Safe BV”? This will retrieve the object properly and the shipments will show up.

Sorry about the hassle on this one, let me know if that works out OK.

For now this is a solution. (I already did)

Hello Marco. This is fixed in the latest version of Quantify, 7.7.1174.112, released yesterday.