RE: [U2] UniSelectList problem

2007-09-27 Thread Dave Davis
So can't you just use SELECT with BY SEQ instead of SSELECT?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, September 26, 2007 5:12 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] UniSelectList problem

Found two things

The LastRecodRead property doesn't seem to work for me unless records
are being read.  (Despite code samples that show it used this way.)  So
I ended up using:
strAP = A_P-INV_MA
ECMD = sess.CreateUniCommand()
ECMD.Command = SELECT   strAP  _
WITH INVN =   invnum   TO 0

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

' Loop through the select list
vnum = 
vname = 
AP_ID = slAP.Next
Do While Not (AP_ID = )
.
.
.
AP_ID = slAP.Next
Loop

2)  The above code works fine when it is a SELECT statement.  However
the same looping structure does not work when it is a SSELECT (sort
select) statement.  The returned list is missing the first ID?

 ' Select keys
 ECMD = sess.CreateUniCommand()
 ECMD.Command = SSELECT   strAP  _
 BY SEQ   _
 WITH INVN =   invnum  _
 AND WITH VENDOR =   vendnum  _
 TO 0
 ECMD.Execute()
 slAP = sess.CreateUniSelectList(0)

 ' Loop through the string array of AP keys
 AP_ID = slAP.Next
 Do While Not (AP_ID = )
.
.  The First ID processed is the second in 
.
AP_ID = slAP.Next() 
Loop

The SSELECT statement works fine at ECL

SSELECT A_P-INV_MA BY SEQ WITH INVN = 7437 AND WITH VENDOR = 5594 TO 0

2 records selected to list 0.

  LIST A_P-INV_MA  Z0 16:04:53 Sep 26 2007 1
A_P-INV*MA Z0..

5594*7437*000
5594*7437*001
2 records listed

However, the SSELECT statement in the VB.NET only contains the second ID
(5594*7437*001) in the list!?!?

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


RE: [U2] UniSelectList problem

2007-09-27 Thread Charles_Shaffer
Dave,

After doing some more testing, I think that I am not cleaning up the first 
list before I do the second.  I am rewriting the app to do all selects in 
one function which will return a string array of keys.  In this way I can 
assure that each select is independant of any other select.  Thanks.

Charles Shaffer
Senior Analyst
NTN-Bower Corporation




Dave Davis [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
09/27/2007 08:05 AM
Please respond to u2-users

 
To: u2-users@listserver.u2ug.org
cc: 
Subject:RE: [U2] UniSelectList problem


So can't you just use SELECT with BY SEQ instead of SSELECT?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, September 26, 2007 5:12 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] UniSelectList problem

Found two things

The LastRecodRead property doesn't seem to work for me unless records
are being read.  (Despite code samples that show it used this way.)  So
I ended up using:
strAP = A_P-INV_MA
ECMD = sess.CreateUniCommand()
ECMD.Command = SELECT   strAP  _
WITH INVN =   invnum   TO 0

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

' Loop through the select list
vnum = 
vname = 
AP_ID = slAP.Next
Do While Not (AP_ID = )
.
.
.
AP_ID = slAP.Next
Loop

2)  The above code works fine when it is a SELECT statement.  However
the same looping structure does not work when it is a SSELECT (sort
select) statement.  The returned list is missing the first ID?

 ' Select keys
 ECMD = sess.CreateUniCommand()
 ECMD.Command = SSELECT   strAP  _
 BY SEQ   _
 WITH INVN =   invnum  _
 AND WITH VENDOR =   vendnum  _
 TO 0
 ECMD.Execute()
 slAP = sess.CreateUniSelectList(0)

 ' Loop through the string array of AP keys
 AP_ID = slAP.Next
 Do While Not (AP_ID = )
.
.  The First ID processed is the second in 
.
AP_ID = slAP.Next() 
Loop

The SSELECT statement works fine at ECL

SSELECT A_P-INV_MA BY SEQ WITH INVN = 7437 AND WITH VENDOR = 5594 TO 0

2 records selected to list 0.

  LIST A_P-INV_MA  Z0 16:04:53 Sep 26 2007 1
A_P-INV*MA Z0..

5594*7437*000
5594*7437*001
2 records listed

However, the SSELECT statement in the VB.NET only contains the second ID
(5594*7437*001) in the list!?!?

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


RE: [U2] UniSelectList problem

2007-09-26 Thread Brian Leach
Charles

What happens if you get the entire list, using

slAP.ReadListAsStringArray()

You can then check the contents of the list stepping through and iterate 
through the array instead of using the Next() method.


Brian,

I tried the following.  I set a breakpoint at 

If Seq = 000 Then
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] UniSelectList problem

2007-09-26 Thread Charles_Shaffer
Brian,

First, thanks for your help.   I tried the following code

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)
Dim strarrAP() As String = slAP.ReadListAsStringArray()

' Loop through the string array of AP keys
Dim I As Int32
For I = 0 To strarrAP.Length - 1
' Get the next key
AP_ID = strarrAP(I)
   .
   .
   .
Next I

After the line Dim strarrAP() As String = slAP.ReadListAsStringArray() 
executes, strarrAP is equal to Nothing.  I am certain there are records 
for the invoice number I entered. The first time the array is accessed, it 
throws an exception (presumably because it is set to nothing)..

I am not understanding something.

I have been mulling around moving some of the logic to the server, but in 
this case the program is only reading a few fields from a few files.  No 
updating of the Unidata database.  If the VB.NET commands will work, that 
seems like a quick easy was to get the data.

Charles Shaffer
Senior Analyst
NTN-Bower Corporation




Brian Leach [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
09/26/2007 05:40 AM
Please respond to u2-users

 
To: u2-users@listserver.u2ug.org
cc: 
Subject:RE: [U2] UniSelectList problem


Charles

What happens if you get the entire list, using

slAP.ReadListAsStringArray()

You can then check the contents of the list stepping through and iterate 
through the array instead of using the Next() method.


Brian,

I tried the following.  I set a breakpoint at 

If Seq = 000 Then
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] UniSelectList problem

2007-09-26 Thread Charles_Shaffer
Found two things

The LastRecodRead property doesn't seem to work for me unless records are 
being read.  (Despite code samples that show it used this way.)  So I 
ended up using:
strAP = A_P-INV_MA
ECMD = sess.CreateUniCommand()
ECMD.Command = SELECT   strAP  _
WITH INVN =   invnum   TO 0

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

' Loop through the select list
vnum = 
vname = 
AP_ID = slAP.Next
Do While Not (AP_ID = )
.
.
.
AP_ID = slAP.Next
Loop

2)  The above code works fine when it is a SELECT statement.  However the 
same looping structure does not work when it is a SSELECT (sort select) 
statement.  The returned list is missing the first ID?

 ' Select keys
 ECMD = sess.CreateUniCommand()
 ECMD.Command = SSELECT   strAP  _
 BY SEQ   _
 WITH INVN =   invnum  _
 AND WITH VENDOR =   vendnum  _
 TO 0
 ECMD.Execute()
 slAP = sess.CreateUniSelectList(0)

 ' Loop through the string array of AP keys
 AP_ID = slAP.Next
 Do While Not (AP_ID = )
.
.  The First ID processed is the second in 
.
AP_ID = slAP.Next() 
Loop

The SSELECT statement works fine at ECL

SSELECT A_P-INV_MA BY SEQ WITH INVN = 7437 AND WITH VENDOR = 5594 TO 0

2 records selected to list 0.

  LIST A_P-INV_MA  Z0 16:04:53 Sep 26 2007 1
A_P-INV*MA Z0..

5594*7437*000
5594*7437*001
2 records listed

However, the SSELECT statement in the VB.NET only contains the second ID 
(5594*7437*001) in the list!?!?

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


Re: *SPAM* RE: [U2] UniSelectList problem

2007-09-25 Thread Charles_Shaffer
David,

I will apply the slAP.LastRecordRead change and see if the firrst ID 
starts showing up.

The GetT4mField starts counting at 0 like the dictionary attribute 
conversion.

:AE DICT A_P-INV_MA SEQ
Top of SEQ in DICT A_P-INV_MA, 8 lines, 32 characters.
*--: P
001: V
002: OCONV(KEY_ID, G2*1)
003:
004:
005: 3L
006: S
007:
008:
Bottom.

Field 3 is field 2.

Really good point about keeping the logic on the server.  I will keep it 
in mind as I go forward. 

I have VB5, VB6 experience, but this is my first Uniobjects and VB.NET 
application.  Thanks for your help.

Charles Shaffer
Senior Analyst
NTN-Bower Corporation




David Jordan [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
09/24/2007 05:54 PM
Please respond to u2-users

 
To: u2-users@listserver.u2ug.org
cc: 
Subject:*SPAM* RE: [U2] UniSelectList problem


Hi Charles

Use the slap.lastrecordread property to check end of select rather that 
key
 .  You could run into funny issues including type mismatches that 
could
fall over.

Also aren't you meant to look in field 3 not field 2 of the key for 000.

If you are new to VB, it is worth considering your design.  With Client
server, it is important to keep the business logic close to the database 
and
not with the client.  The client should be more for display logic.  If you
keep the business logic in subroutines in Uv, then you can reuse the
business logic for web pages, web services and other applications.

Regards

David Jordan
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: *SPAM* RE: [U2] UniSelectList problem

2007-09-25 Thread Charles_Shaffer
In the VB.NET application that I am working on, I need to select a list of 
records and read the keys one at a time.  The data I am getting is in the 
key.  Do I need to open the file to pull down the select list from the 
server?  Also, since I do not need to read the record, will the 
LastRecordRead property really signal the end of the select list?  Or do I 
need to be reading records for the LastRecordRead to work?

Charles Shaffer
Senior Analyst
NTN-Bower Corporation




David Jordan [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
09/24/2007 05:54 PM
Please respond to u2-users

 
To: u2-users@listserver.u2ug.org
cc: 
Subject:*SPAM* RE: [U2] UniSelectList problem


Hi Charles

Use the slap.lastrecordread property to check end of select rather that 
key
 .  You could run into funny issues including type mismatches that 
could
fall over.

Also aren't you meant to look in field 3 not field 2 of the key for 000.

If you are new to VB, it is worth considering your design.  With Client
server, it is important to keep the business logic close to the database 
and
not with the client.  The client should be more for display logic.  If you
keep the business logic in subroutines in Uv, then you can reuse the
business logic for web pages, web services and other applications.

Regards

David Jordan
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] UniSelectList problem

2007-09-25 Thread Brian Leach
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
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] UniSelectList problem

2007-09-25 Thread Charles_Shaffer
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: u2-users@listserver.u2ug.org
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
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http

RE: [U2] UniSelectList problem

2007-09-24 Thread David Jordan
Hi Charles

Use the slap.lastrecordread property to check end of select rather that key
 .  You could run into funny issues including type mismatches that could
fall over.

Also aren't you meant to look in field 3 not field 2 of the key for 000.

If you are new to VB, it is worth considering your design.  With Client
server, it is important to keep the business logic close to the database and
not with the client.  The client should be more for display logic.  If you
keep the business logic in subroutines in Uv, then you can reuse the
business logic for web pages, web services and other applications.

Regards

David Jordan
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] UniSelectList problem

2007-09-24 Thread Kate Stanton
David, I couldn't agree more.  Use the client stuff to interface with the 
user, and write the gutsy stuff in UniVerse.  Almost always do I/O in 
UniVerse: apart from anything else, it is so much more robust.  If the 
client goes down, it doesn't matter, just restart it and maybe start your 
procedure again.


Also means that as user interfaces develop, the business rules still stay 
the same.  If the data processing is done in UniVerse, it makes it easy to 
adopt new user interfaces.


Cheers, Kate

- Original Message - 
From: David Jordan [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Tuesday, September 25, 2007 10:54 AM
Subject: RE: [U2] UniSelectList problem



Hi Charles

Use the slap.lastrecordread property to check end of select rather that 
key
 .  You could run into funny issues including type mismatches that 
could

fall over.

Also aren't you meant to look in field 3 not field 2 of the key for 000.

If you are new to VB, it is worth considering your design.  With Client
server, it is important to keep the business logic close to the database 
and

not with the client.  The client should be more for display logic.  If you
keep the business logic in subroutines in Uv, then you can reuse the
business logic for web pages, web services and other applications.

Regards

David Jordan
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/ 

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/