Configuring Actions Menu

Configuring Actions Menu

DBEdit allows adding items into the application Actions menu.

For example, this menu contains items added by SaveToDB Developer Framework used to generate database objects:

To add menu items, add records into a handler configuration table like xls.handlers with the Actions event type.

For example, this configuration adds a single menu item, "See Online Help":

Also, you may use views to generate the handler configurations.

For example, the following view adds "See Online Help" links for every selectable object in the s02 schema.

CREATE VIEW s02.xl_actions_online_help
AS
SELECT
    t.TABLE_SCHEMA
    , t.TABLE_NAME
    , CAST(NULL AS nvarchar(128)) AS COLUMN_NAME
    , 'Actions' AS EVENT_NAME
    , t.TABLE_SCHEMA AS HANDLER_SCHEMA
    , 'See Online Help' AS HANDLER_NAME
    , 'HTTP' AS HANDLER_TYPE
    , 'https://www.savetodb.com/samples/sample'
        + SUBSTRING(t.TABLE_SCHEMA, 2, 2) + '-' + t.TABLE_NAME
        + CASE WHEN USER_NAME() LIKE 'sample%' THEN '_' + USER_NAME() ELSE '' END AS HANDLER_CODE
    , CAST(NULL AS nvarchar(128)) AS TARGET_WORKSHEET
    , 1 AS MENU_ORDER
    , 0 AS EDIT_PARAMETERS
FROM
    INFORMATION_SCHEMA.TABLES t
WHERE
    t.TABLE_SCHEMA = 's02'
    AND NOT t.TABLE_NAME LIKE 'xl_%'
UNION ALL
SELECT
    t.ROUTINE_SCHEMA AS TABLE_SCHEMA
    , t.ROUTINE_NAME AS TABLE_NAME
    , CAST(NULL AS nvarchar(128)) AS COLUMN_NAME
    , 'Actions' AS EVENT_NAME
    , t.ROUTINE_SCHEMA AS HANDLER_SCHEMA
    , 'See Online Help' AS HANDLER_NAME
    , 'HTTP' AS HANDLER_TYPE
    , 'https://www.savetodb.com/samples/sample'
        + SUBSTRING(t.ROUTINE_SCHEMA, 2, 2) + '-' + t.ROUTINE_NAME
        + CASE WHEN USER_NAME() LIKE 'sample%' THEN '_' + USER_NAME() ELSE '' END AS HANDLER_CODE
    , CAST(NULL AS nvarchar(128)) AS TARGET_WORKSHEET
    , 1 AS MENU_ORDER
    , 0 AS EDIT_PARAMETERS
FROM
    INFORMATION_SCHEMA.ROUTINES t
WHERE
    t.ROUTINE_SCHEMA = 's02'
    AND NOT t.ROUTINE_NAME LIKE 'xl_%'
    AND NOT t.ROUTINE_NAME LIKE '%_insert'
    AND NOT t.ROUTINE_NAME LIKE '%_update'
    AND NOT t.ROUTINE_NAME LIKE '%_delete'
    AND NOT t.ROUTINE_NAME LIKE '%_change'
    AND NOT t.ROUTINE_NAME LIKE '%_merge'

The view selects the same columns as defined in the xls.handlers table.

You may use this technique for other configuration tables also.

Context Parameters

Application menu handlers can use the following context parameters:

Parameter NameValue
@DataLanguage or @data_languageA data language code selected using the Options dialog box
@TableName or @table_nameA qualified name of the active query object like [s02].[usp_cashbook]
@WindowsUserName or @windows_user_nameThe Windows login of the current user
This website is using cookies. By continuing to browse, you give us your consent to our use of cookies as explained in our Cookie Policy.