palmtree with sun behind it CONTACT US
Phone: (412) 835-9417
Email: sales@vss3.com

Tip # 39 - Browse Toggle


Displaying Browse Lookups is a great way to allow the end-user to view data in a report format on the screen.  Since, the data viewed is limited to 80 characters, or the data might need to be filtered to narrow the data viewed, I often use a function I call TOGGLE.

This is not really a browse function, but using the browse processing, I can offer the user an easy filter of the data.  By offering a switch with a keystroke at the bottom of the browse, I can change the display to be more specific, drill into the data, or change the columns displayed.  I call this switch keystroke a toggle and it can be very simple to implement and offer the user a more flexible mode of display.

For example, in the following logic, the toggle changed a list of zip codes for all states to just a display of the selected state.  Hit the keystroke for the toggle again, and all zip codes are displayed. 

Oct 21, 2003 11:16 File Name: Browse Page 1

Processing: input

67 ------- - - - - - - - - - - - - - - - -

@key7 If:

Then: declare toggle(5,,g)

68 ------- - - - - - - - - - - - - - - - -

If: toggle ne "STATE" and toggle ne "ALL"

Then: toggle="ALL" 'default for toggle for first access

69 ------- - - - - - - - - - - - - - - - -  ' use the toggle data to display the choice and document the current browse

If: toggle eq "STATE"

Then: cls("19","1");showctr("19")"Partial Match-on STATE CODE ONLY"<6

70 ------- - - - - - - - - - - - - - - - -

If: toggle eq "ALL"

Then: cls("19","1");showctr("19")"ALL Zip Displayed by State"

71 ------- - - - - - - - - - - - - - - - - ' change the prompts below the browse to indicate the next toggle choice

If: toggle eq "ALL"

Then: prompt_line="\{T} - Toggle to STATE ONLY, \{X} - Exit Browse"; gosub showc

72 ------- - - - - - - - - - - - - - - - -

If: toggle eq "STATE"

Then: prompt_line="\{T} - Toggle to ALL Zips by STATE, \{X} - Exit Browse"; gosub showc

73 ------- - - - - - - - - - - - - - - - - ' use index C (built on State & ZipCode) to narrow the list by matching exactly the State

If: toggle eq "STATE"                    ' the mlen=2 with the -nxm for match exactly will do this restriction

Then: lookup zip = moszip k=6 i=C -nxm b="(brw=12 xkey=TX mlen=2 fill=asc)[Zip City State]*1 *2 *3"

74 ------- - - - - - - - - - - - - - - - -

If: toggle eq "ALL"                        'this will list the browse by State then Zipcode but will not restrict the display

Then: lookup zip = moszip k=6 i=C -nx b="(brw=12 xkey=TX fill=asc)[Zip City State]*1 *2 *3"

75 ------- - - - - - - - - - - - - - - - -

If: not zip or @bk eq "X" or @sk eq "BRKY"            'check for exit or break to end the browsing

Then: end

76 ------- - - - - - - - - - - - - - - - -

If: toggle eq "ALL" and @bk eq "T"                    'use this like a switch if it is ON turn it OFF and then repeat the browse

Then: toggle="STATE";goto @key7

77 ------- - - - - - - - - - - - - - - - -

If: toggle eq "STATE" and @bk eq "T"

Then: toggle="ALL";goto @key7

78 ------- - - - - - - - - - - - - - - - -

If:

Then: end


This can be helpful for things like this:  One browse that can change from OPEN to CLOSED to ALL orders by hitting the same TOGGLE keystroke.  One browse that can show a display with items ORDERED / items SHIPPED with a toggle.  One browse that can be used to drill into data, by displaying first all the orders for a customer, hit a toggle and then the selected order is expanded, hit a toggle and the item selected is expanded to display pending shipments, production for that order, location of that item or whatever is appropriate.

Have fun with this.


Written by Nancy Palmquist

Copyright, 1997 by Virtual Software Systems.  All rights reserved.

Contact Us by: Email to Virtual Software Systems or Phone: (412) 835-9417