Brian,

I tried the following.  I set a breakpoint at 

If Seq = "000" Then

First time through Seq was 001,  It sure looks like it is skipping the 
first ID in the Select List.  000

' Sort select the required records from AP file
        Try
            rnum = ""
            pnum = ""

            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 (Not slAP.LastRecordRead)
                ' Read the record from the AP file
                dynAP = flAP.Read(AP_ID)

                ' Get Line Number
                Seq = GetT4mField(AP_ID, 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

        Catch ex As Exception
            MsgBox("GetInvApDetail Error" & vbCrLf & vbCrLf & _
                    " invnum = " & invnum & vbCrLf & _
                    " recnum = " & recnum & vbCrLf & _
                    " ponum = " & ponum & vbCrLf & _
                    ex.Message, MsgBoxStyle.Critical)
        Finally
            ' Clean up
            flAP.Close()
            flAP.Dispose()
            dynAP = Nothing
            slAP.Dispose()
            slAP = Nothing
        End Try
Charles Shaffer
Senior Analyst
NTN-Bower Corporation




Brian Leach <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
09/25/2007 09:11 AM
Please respond to u2-users

 
        To:     <[email protected]>
        cc: 
        Subject:        RE: [U2] UniSelectList problem


Charles

Does it work if you pull the sequence number from the key (AP_ID) rather 
than trying to get it from dynAp.Extract(0) ? That's just the record...

Regards

Brian

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/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to