PO Receipt of Goods EditKey EditLine

SUGGESTED

I have a working Receipt of Goods Visual Studio VB console app.  It's an integration project.  I have a textfile that has the receiving data.  It's easy enough to MoveFirst and MoveNext and match the text data to the PO Line using LineKey (or I could use Item or both).

I was hoping to make a more elegant solution.  Since I have the LineKey (000001, 000002, etc), I thought I could use EditKey and EditLine and skip the MoveFirst and MoveNext but GetEditKey is giving me null.

Here's the code (not testing return values unless I have to for now while I'm messing around):

r = oBUS.nGetNextReceiptNo(RNo)
r = oBUS.nSetKeyValue("ReceiptNo$", RNo)
r = oBUS.nSetKey()
r = oBUS.nSetValue("PurchaseOrderNo$", PONo)

r = oBUS.nCopyPurchaseOrderLines(0)     '0 do not set qtys, 1=receive complete

Do Until txtline = ""

EditKey = oBUS.oLines.sGetEditKey(LineKey) 'I have the line key from txtline (example 000001 or 000002)
MsgBox("editkey " & EditKey)

r = oBUS.oLines.nEditLine(EditKey)

r = oBUS.oLines.nGetValue("ItemCode$", LItem)
r = oBUS.oLines.nGetValue("LineKey$", LLineKey)

I'm baffled as to why this is not working.  There is obviously something I am not understanding.

EditKey is DIM as string and I set it to "" in the very beginning:

Dim EditKey As String

EditKey = ""

Parents Reply Children
  • 0 in reply to Kevin M
    SUGGESTED

    Instead of looping through with MoveFirst and MoveNext.  You can use the GetResultSets method from the lines object and have it return the receipt detail's LineKey and use a filter on the OrderLineKey as Kevin mentioned.  Refer to the FLOR for more info on GetResultSets and you can also find some details and examples on using it on this forum. Just search for GetResultSets.

    help-sage100.na.sage.com/.../index.htm

    Technically, the method is still reading through the lines but saves you the trouble of moving to each line, getting the value in OrderLineKey and comparing it to the line key in your source file.