Part Bin Onhand Quantity using Adapter

I am attempting to pull in the on hand quantity for a part using the PartBinSearchAdapter. Using the BL tester and inputing parameters a row is returned. When I use the code below no row is returned. Any ideas why I would not get data when I do in the BL Tester using the exact parameters as are passed in the code?

Dim JobMtl As EpidataView = Ctype(oTrans.EpiDataViews("JobMtl"),EpiDataView)
Dim lotNum As String = EpiTextBoxC1.Text
Dim partNum As String = JobMtl.dataView(JobMtl.Row)("partNum")

Dim PartBinAdapt As PartBinSearchAdapter = New PartBinSearchAdapter([RQForm])
PartBinAdapt.BOConnect()
Dim PartBin As Erp.BO.PartBinSearchDataSet = PartBinAdapt.GetPartBinByLot(partNum, lotNum)
OHQty = PartBinAdapt.PartBinSearchData.Tables("PartBinSearch").Rows(0)("QtyOnHand")
PartBinAdapt.Dispose()

Have you verified that you have valid values in lotNum and partNum variables?

Yes, I even hard coded the values I wanted for partNum and lotNum and no data is returned.

Having banged my head on the wall with similar specialized methods in adapters, I feel your pain.

Usually after I’ve wasted an hour, I give up and resort to GetRows/GetList using a where clause.

Also I see you are passing the form in to the constructor of PartBinSearch adapter. Can you do that? I am used to passing the oTrans.

Oh I think I see the issue. You are placing the result of GetPartBinByLot to a DataSet (called PartBin) but then you are trying to pull the results from the built-in dataset in the adapter.

Try changing:

OHQty = PartBinAdapt.PartBinSearchData.Tables("PartBinSearch").Rows(0)("QtyOnHand")
to
OHQty = PartBin.Tables("PartBinSearch").Rows(0)("QtyOnHand")


Perfect, changed to this and it worked. I was using it like I do for GetyByID on UD tables, now I see.

OHQty = PartBin.Tables(“PartBinSearch”).Rows(0)(“QtyOnHand”)

1 Like

Sweet, throw this dog a solution bone :smile: