Hello,

I am new to the list, but old to PICK.

Working with Uniobjects in VB.NET to access a Unidata 7 backend database. 
I am selecting records from an Accounts Payable file.  The key is made up 
of 
VendornNumber*InvoiceNumber*SequenceNumber.  Only the record with a 
sequence number of 000 will contain the check number.  All other sequence 
numbers contain PO Number and Receiver Numbers.  Here is an example from 
ECL.

LIST A_P-PAYMENT-HIST_MA INVN VENDOR RCVR_NUM PO_NUM CHECK_NUMBER 15:59:01 

Sep 21 2007 1
A_P-PAYMENT-HIST_MA INVN...... VENDOR.... RCVR_NUM.. PO_NUM CHECK_NUMBER

4240*84031*000      84031      4240                               105285
4240*84031*001      84031      4240       173351     041064
2 records listed

I am trying to select these records in a VB.NET program using Uniobjects 
(Imports IBMU2.UODOTNET) with the following code.
      Dim flAP As UniFile = Nothing 
      Dim ECMD As UniCommand = Nothing
      Dim slAP As UniSelectList = Nothing
      Dim AP_ID As String = ""
      Dim dynAP As UniDynArray = Nothing
      Dim Seq As String = ""

      ECMD = sess.CreateUniCommand()
      ECMD.Command = "SSELECT " & strAP & _
                     " BY SEQ " & _
                     " WITH INVN = " & invnum & _
                     " AND WITH VENDOR = " & vendnum & " TO 0"

      ' Select keys
      ECMD.Execute()
      slAP = sess.CreateUniSelectList(0)

      AP_ID = slAP.Next
      Do While (AP_ID <> "")
             ' Read the record from the AP file
           dynAP = flAP.Read(AP_ID)

           ' Get Line Number
           Seq = GetT4mField(dynAP.Extract(0).ToString, 2, "*")

           If Seq = "000" Then
                   ' Header line.  Get checknumber.
                 strItem = dynAP.Extract(33).ToString
                 checknum = GetT4mField(strItem, 2, "*")
           Else
                 ' Detail line get receiver number and PO number
                 rnum = dynAP.Extract(17).ToString
                 AddItemUnique(recnum, rnum)
                 pnum = dynAP.Extract(28).ToString
                 AddItemUnique(ponum, pnum)
           End If
           AP_ID = slAP.Next
      Loop


I have tried several variations of this with the same result.  The select 
list seems to be missing the first key.  The one with the 000 sequence 
number.

Is there a bug in CreateUniSelectList?

Am I doing something wrong?

Charles Shaffer
Senior Analyst
NTN-Bower Corporation
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to