Download File

 Show all Hide all

Downloads a file from the database.

Component modes: Download file

Component mode: Download file

The file can be downloaded to the user's computer.

File modes: Download

File mode: Download

The user downloads the file.

SQL

SQL Call: Retrieve file (mandatory)

SQL to retrieve the file from the database.

May modify database: No

Resultset: File

Resultset with file to download.
Repeat mode: repeated exactly once
Row count: exactly one row

Columns:

xxx mandatory binary
Image column that contains the file to be downloaded, column name is free of choice.
xxxcontenttype mandatory string
Column that contains the MIME type of the file.
xxxfilename mandatory string
Column that contains the filename of the file.

SQL Call: Finished

Component wants to know where to forward to, if forwarding is set to "Forward dynamically".

May modify database: No

Parameters:

@Forward bit
Set to '1' by Softadmin® when the component is finished.

Resultset: Forwarding definitions (optional)

Repeat mode: repeated zero or more times
Row count: exactly one row

Columns:

<querystring_variable> optional string
Any column with no other specific meaning will pe passed along on the querystring to the menuitem you are forwarding to.
ADMIN_CancelCidStepsBack optional int
Number of steps in the page history to jump back if the user clicks OK in an ADMIN_MESSAGE dialog or Cancel in an ADMIN_FORCE dialog (the default being none). This value overrides cancelcidstepsback specified in the query string.
ADMIN_CancelMenuItem optional string
Alias of the menuitem to execute if the user clicks OK in an ADMIN_MESSAGE dialog or Cancel in an ADMIN_FORCE dialog (the default being none). This value overrides cancelmenuitemid specified in the query string.
ADMIN_CancelMenuItemId optional int
Deprecated. Use ADMIN_CancelMenuItem instead.

Id of the menuitem to execute if the user clicks OK in an ADMIN_MESSAGE dialog or Cancel in an ADMIN_FORCE dialog (the default being none). This value overrides cancelmenuitemid specified in the query string.
ADMIN_CidStepsBack optional int
Number of steps in the page history to jump back after execution (the default being one step back). This value overrides any destination specified by the query string.
ADMIN_Force optional string
Prompts the user with the specified text and the user may answer OK or cancel. If the user chooses OK the sql call will be rerun with the parameter @force set to 1.
ADMIN_Forward optional string
Displays a user friendly message and then forwards to the next menu item.
ADMIN_ForwardMenuGroupId optional int
Id of the menu group to show after execution (instead of former menu item). This value overrides any destination specified by the query string.
ADMIN_ForwardMenuItem optional string
Alias of the menuitem to execute after execution (instead of former menu item). This value overrides any destination specified by the query string.
ADMIN_ForwardMenuItemId optional int
Deprecated. Use ADMIN_ForwardMenuItem instead.

Id of the menuitem to execute after execution (instead of former menu item). This value overrides any destination specified by the query string.
ADMIN_Message optional string
Displays a user friendly message to the user.
ADMIN_PasteHtmlFromPopup optional string
Pastes HTML. See admin_setfieldvaluefrompopup
ADMIN_SetFieldValueFromPopup optional string
Sets the value of field specified in the menuitempopup call. Only select this column if menuitem is opened in popup.
ADMIN_ClosePopup optional bit
If this column is anything but NULL the popup will be closed. Only select this column if the menuitem is opened in popup.
Default: The default behavior is to step back inside the popup window and close it if there is nothing to step back to.
Cache optional string
Cache key to be cleared. Supports wildcards.
CacheUserId optional string
Either a user id or '%'.

Clears all caches (e.g. access permissions) related to the specified user id.

Use '%' to clear caches for all users.
CancelButtonText optional string
Changes the text of the Cancel button when used with ADMIN_Force.
OkButtonText optional string
Changes the text of the OK button when used with ADMIN_Message, ADMIN_Force, or ADMIN_Forward.

SQL Call: Validate parameters

Allows you to validate the parameters supplied by the user before any other SQL is run in the component. This call is only made if the component has visible parameters, the SQL is a stored procedure, and 'Validate parameters' is checked.

May modify database: No

Parameters:

@Force bit
Set to 1 if the last call to validate parameters used admin_force and the user clicked OK in the OK/Cancel dialog.
@ValidateParams bit
Set to 1 when this call is made.

Custom access control and logging

SQL Call: Custom access control and logging

Use this call to restrict which entries a user is allowed to view and edit, and to log which entries a user views.

Access to a menu item is normally controlled through functions and roles alone but some entities need more fine grained control. For example, a user may have access to the View Member menu item for normal members but not for members with a protected identity.

The menu items a user visits are always logged (in ADMINLogMenuItem) but for sensitive data you may need to log exactly what entries are viewed. Do the logging in this call as the common ways of viewing data (grid and InfoSQL) are not allowed to modify the database.

If you bind a scalar function instead of a stored procedure to this call then its name must end with '_GrantAccess'.

May modify database: Yes

Resultset: Access permissions

Return whether the user is allowed to visit the menu item with the current parameters.
Repeat mode: repeated exactly once
Row count: exactly one row

Columns:

GrantAccess mandatory bit
1 if the user is allowed to view the menu item, 0 if the user should not be allowed to view the menu item.

If 0 then an error will be logged as the user should not have been able to reach the menu item with the given parameters in the first place.

Examples

Download file

ALTER PROCEDURE Util.Template_Download
	@Id int
AS
BEGIN
	SELECT
		T.Document,
		T.DocumentContentType,
		T.DocumentFilename
	FROM
		Util.Template T
	WHERE
		T.DocumentId = @Id;
END