Re: Windows sorting


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Grant on November 16, 2011 at 13:30:39:

In Reply to: Windows sorting posted by Grant Foraker on November 15, 2011 at 07:38:42:

After two days of dead ends and bad assumptions, I found a way to beat the sort problem with out too much code change. The idea of stripping out special characters (-,+, etc) would have led to unwanted duplications.

Up to this program (Vendor Invoice Entry (NE)), a two tab program, I didn't care about or even notice the sort difference. But, this program adds records to the N9, redisplays the list, anchors itself to the new record via highlighting, and then proceeds to the TAB 2 logic.


LoadInvoiceList:
TD.PageNum = 1
Gosub TD.SetPageDialog

GOSUB DisableKeyFields
GOSUB DisableDataFields

Let cosCTlId = IDC.LIST.01
Gosub COS.ListResetContent

! Set tab stop beyond edge of listbox window
! so key is out of sight
cosCtlText$ = IntelD(150)
Gosub COS.ListSetTabStops
LET ListItem = 0
LET ListIndex = 0
LET ICOUNT = 0
POSITION (4) KEY = ''
LIL10:
LET N9KEY$ = KEY(4, EXCP = LIL80)
INQUIRE (4,1491) KEY = N9KEY$
IF SEQ$ NE ' 1' GOTO LIL20 ! NOT HEADER RECORD
IF TRCODE$ EQ 'BF' GOTO LIL20 ! FIXED EXPENSE, SKIP

Let cosCtlText$ = VNBR$ + ' ' + INV$ + ' ' + TRCODE$ + ' ' + N9KEY$
LET coswParam = ListIndex
Gosub COS.ListAddStringData
LET ListIndex = ListIndex + 1
LET ICOUNT = ICOUNT + 1
LIL20:
POSITION (4) KEY = VNBR$ + INV$ + '@FF@' ! SKIP Distributions
GOTO LIL10 ! DISPLAY NEXT Invoice
LIL80:
IF EXCP EQ 2 GOTO LIL90
GOTO ProgramError
LIL90:
IF STRIP(HIN9KEY$) NE ''
LET cosItemId = 0 ! start at top of list
LET cosCtlText$ = SUB(HIN9KEY$,1,5) + ' ' + SUB(HIN9KEY$,6,20) ! text to match
GOSUB COS.ListFindString
IF cosItemId GE 0 LET LISTITEM = cosItemId ! -1 means a miss
LET HIN9KEY$ = ''
ENDIF

After each new item is added to the N9 file I refresh the list with "GOSUB LoadInvoiceList". This way the A/P clerk can see that the new item has been added and see any new items added by any other A/P clerk.

At the end of the routine I check HIN9KEY$ for the record to highlight. If HIN9KEY$ is empty, I highlight the first record.

To find the desired record, I use "GOSUB COS.ListFindString" which returns the record index of the first record that begins with the text I give it. Begins is the key part. Contains doesn't work.


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?  

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):





Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]