ShipHead.UpdateMaster fails - ...ShipHead has more than 1 record

I’m trying to create a ShipDtl record with a function after the ShipHead record has already been created. The important pieces of the function are highlighted -

.

When my function calls ShipHead.UpdateMaster - I get an error message -
The table dsCustShipDtlFx.ShipHead has more than one record which has me very confused.

Dog What GIF by MOODMAN

What am I missing?

Thanks!

LOL. It all looks fine. In your debugs are you writing to a serverlog or event viewer? If so I would add a dsCustShipDtlFx.ShipHead.Count to see where the second record creeps in. I admire you doing it all in widgets, I would not have the patience.

My debugs are writing to the event log. Good idea on the record count. My record counts are what I expect (1) until GetOrderRelInfo is called. After GetOrderRelInfo is called, my record count for ShipHead increments to 2.

I can’t think of any reason that should happen. I’ve disabled the method directives on GetOrderLineInfo and GetOrderRelInfo to eliminate them as a possibilty, but still get the same result.

Is there a simple way to dump some or all of the dataset into my debug log entry?

You could shove it into a json and write that. There seems to be some quirks to add shipdtl lines.

Dumping the dataset out to json was a good suggestion. The dataset after calling GetOrderLineInfo has 2 records of ShipHead. One record is as it was prior to calling the BO. The other includes the additional information from the order. A key difference between the 2 records is the setting of the CustNum field.

My solution to this problem in widget world is to use the Fill Table by Query widget to copy the single updated ShipHead record into a new dataset along with the ShipDtl table and then continue processing with the new dataset.

This got me past the “ShipHead has more than 1 record” error. I’m now trying to figure out a new error, but that’s for another post.

1 Like