Author Topic: SB+ Tip: MyMenu  (Read 5511 times)

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1609
    • Precision Solutions
SB+ Tip: MyMenu
« on: July 05, 2007, 08:42:33 am »
All of my clients at one time or another have requested custom menus for individual users.  In the past, we've always followed the "SB+ standard method" and created specific menus (and corresponding processes) for each user.  However, this can become something of a management issue as a) people forget what their menu process name is [even when it is their initials], and b) there can be a lot of otherwise meaningless menu processes to manage based on the number of people who need this feature.

For one particular customer, I've come up with an interesting idea which we're calling MyMenu.  This is a slash process /MYM which brings up a different menu for each person.  The advantage is a) everyone uses the same /process so there's minimal training needed, b) one single process is easier to support and install than several, and c) with one central list the custom user menus can be identified very easily.

Frankly, I'm surprised I didn't think of this years ago.  Here's the SB+ paragraph (entered via /PD.P) named MYM:

LOCAL L.MENU
*
@VALUE = @USER.ID
L.MENU  = TABLE('MYM')
IF L.MENU # '' THEN
  EXEC 'M:' : L.MENU
END ELSE
  ERROR 'No custom menu has been defined for you at this time.'
END

As you can see on line 4, this uses a /TABLE.DEFN called MYM in the current system to determine which menu is to be used for which user.  On this table definition the Internal Code is the person's SB+ user ID, and the Display Text is the name of the menu to be invoked for that person.  (The Input Code is not used here.)  If you're using an application that has multiple systems, a person will have a different MyMenu for each system.  Or, you could modify line 4 to look in a specific system for the MyMenu, but that creates new issues as each system may actually have different menus.

Also notice that the menu is being EXEC'd via the M: inline code.  This eliminates the need for any other menu processes (created via /PD.M), which means that once MYM is installed, you can add menus and adjust the table and be done with it.

I'm posting here in case anyone else needs something like this, hope it helps someone!
-Kevin
Accidents "happen"; success, however, is planned and executed.