SoftadminGuide.MenuItem_Create

Type: Stored procedure

Creates Softadmin® Menu items.
Expects a temp table created using SoftadminGuide.MenuItem_Definition and two optional temp tables created using SoftadminGuide.MenuItemProcedureParameter_Definition and/or SoftadminGuide.MenuItemFieldTable_Definition.

Example

SELECT * INTO #MenuItem FROM SoftadminGuide.MenuItem_Definition();

DECLARE @MenuItemGuid uniqueidentifier = NEWID();

INSERT INTO #MenuItem
(
    MenuItemGuid,
    Component,
    MenuItemName,
    MenuGroupGuid,
    MenuSubgroupGuid,
    ComponentProcedureName,
    HideMenuItem,
    ConfirmationText,
    IdParameterName
)
SELECT
	@MenuItemGuid,
	'Delete',
	'Delete car',
	@MenuGroupGuid, -- An existing menu group
	@MenuSubgroupGuid, -- An existing menu subgroup
	'MySchema.Car_Delete',
	1,
	'Are you sure you want to delete the car?',
	'CarId';

SELECT * INTO #MenuItemProcedureParameter FROM SoftadminGuide.MenuItemProcedureParameter_Definition();

INSERT INTO #MenuItemProcedureParameter
(
    MenuItemGuid,
    Part,
    ProcedureParameterName,
    SessionVariable
)
VALUES
(
	@MenuItemGuid,
	'Component',
	'UserId',
	'UserId'
);

SELECT * INTO #MenuItemFieldTable FROM SoftadminGuide.MenuItemFieldTable_Definition();

INSERT INTO #MenuItemFieldTable
(
    MenuItemGuid,
    FieldTable
)
VALUES
(
	@MenuItemGuid,
	'MySchema.Car'
);

EXEC SoftadminGuide.MenuItem_Create
	@UserId = @UserId;

Parameters

@UserId mandatory int
The user running the guide.

Resultsets

Resultset: #MenuItem

A temporary table used as input to the procedure. Containing the menu items to create.
Table count: repeated exactly once
Row count: one or more rows
Columns
MenuItemGuid mandatory uniqueidentifier

Identifies the menu item.

Component mandatory string

Component type

Possible value Description
Delete
Detailview Detail view with or without tabs (component mode TabView or InfoView).
Dynamic tabs not supported.
Edit NewEdit in component mode "Edit".
Grid
New NewEdit in component mode "New".
MenuItemName mandatory string

Name of menu item.

MenuGroupGuid mandatory uniqueidentifier

All menu items must be part of a menu group.

MenuSubgroupGuid optional uniqueidentifier

A menu item may be part of a subgroup.
Has no meaning if HideMenuItem = 1.

ComponentProcedureName optional string

Stored procedure used by the menu item. Usage depends on the component.

HideMenuitem mandatory bit

Set to 0 to list the menu item in the menu group.

InsertUpdateProcedureName optional string

The only guide-supported component that used the InsertUpdate-procedure is NewEdit ('New' and 'Edit').

IdParameterName optional string

Only used by NewEdit and Delete.
Name of the identifying parameter passed to the procedures of the NewEdit and Delete components.

Default: For NewEdit and Delete component: If NULL, the identifying parameter will be named "@Id".

Resultset: #MenuItemProcedureParameter

A temporary table used as input to the procedure. Containing the input parameters for the procedure calls. Specify exactly one of these columns, and leave the rest as NULL:
* PassingField
* Boolean
* SettingName
* SessionVariable
* SpecialValue
Table count: repeated zero or one time
Row count: one or more rows
Columns
MenuItemGuid mandatory string

The menu item to set procedure parameters for.

Part mandatory varchar

Determines which procedure the parameters should be attached to.

Possible value Description
Component
InfoSql
InsertUpdate
ProcedureParameterName mandatory nvarchar

Name of the parameter to the SQL procedure.

PassingField optional varchar

Name of a passing field used as value.

Boolean optional bit

A static bit used as value.

SettingName optional varchar

Name of a system setting used as value.

SessionVariable optional varchar

Session variable used as value. Refer to Admin -> "Session variables" for possible values.

SpecialValue optional varchar

Special value used as value. Special information from the platform.

Possible value Description
Client IP The IP address that the user is currently accessing the system from. Not defined when there is no user, for example because the menu item is executing as a job.
Current menu item ID The ID of the current menu item.
Is popup If the current menu item is in a popup.
Parent menu item SQL The SQL that was executed on the previous visible menu item.

Resultset: #MenuItemFieldTable

A temporary table used as input to the procedure. Containing the field tables to use for the respective menu item.
Table count: repeated zero or one time
Row count: zero or more rows
Columns
MenuItemGuid mandatory uniqueidentifier

The menu item to set field table for.

FieldTable mandatory string

Field table.