Browsing multivalues

As long as a browser program understands that the identifiers returned by BTPFIND and BTPSEQ for a multivalued B-tree have appended multivalue numbers, it can operate just like a browser for single valued attributes. For example, the BROWSE.NAMES sample browser in BTP/Branches #1 can be enhanced to correctly display the multivalued dates in attribute 7 of NAMES items just by editing the following nine lines:

007 EQU AMC$DATES TO 7
012 EQU root4 TO "DATES"
026 ROOT = root4 ; FRAG = AMC$DATES
037 READ ITEM FROM NFILE,FIELD(CURR.ID,"*",1) ELSE GOTO 100
078 READ ITEM FROM NFILE,FIELD(NEXT.ID,"*",1) ELSE GOTO 100
103 READ ITEM FROM NFILE,FIELD(NEXT.ID,"*",1) ELSE GOTO 100
161 CURR.ID = OCONV(COMMAND,"MCN"):"*1"
163 READ ITEM FROM NFILE,FIELD(CURR.ID,"*",1) ELSE FOUND=0
185 CRT OCONV(ITEM<AMC$DATES,FIELD(NEXT.ID,"*",2)>,"D2-") ("R#":ADR.LEN):" ":

The above code will cause the exploded multivalued dates to be displayed in place of the address column. Most of the above changes are simply uses of the FIELD function to insure that each READ of the data file will ignore the multivalue number appended to the item identifiers returned by BTPFIND and BTPSEQ.

The changed browser begins by displaying items in multivalued date order. Each NAMES item appears in the browser display for as many dates as the item contains in attribute 7. The item ID number column in the browser's display includes the asterisk and multivalue number to indicate what multivalue each row of the display represents. Left as an exercise are: making V's appear at the top of the dates when that column is sorted (see browser lines 063 to 073), adding a browser command to go back to sorting the date column after another root is chosen (see lines 142 to 147), letting the browser N command work on the date column (see lines 148 to 157), and allowing an arbitrary date search (see lines 165 to 176).