This field type inserts the controls specified by an sql query into the normal flow of controls on the page.
If the multi-control is in temp table mode then its data will be saved in a temp table like this:
CREATE TABLE #xxx
(
/* The value from the Id column when the multi-control created the controls,
or field name if the multi-control did not use the Id column, but
using an explicit Id column is strongly recommended. */
Id nvarchar(MAX) NOT NULL,
/* The control's value. */
Value nvarchar(MAX) NULL,
/* This column only exists if the multi-control contains controls that
return binary data, for example the File control. For those controls
Value will be NULL and ImageValue will contain their data. */
ImageValue varbinary(MAX) NULL,
/* This column only exists when the ImageValue column is used and
multi-control contains a control type that returns a filename.
For example, the File control uses file names but the Signature
control does not. */
ImageValueFileName nvarchar(MAX) NULL,
/* This column only exists when the ImageValue column is used. */
ImageValueContentType nvarchar(MAX) NULL,
/* This column only exists for backwards compatibility. Ignore it.
It will be present when the multi-control contains a File control. */
ImageValueContentSize int NULL,
/* This column only exists when the multi-control contains controls
that return their data in a temporary table, for example the
multirow control. */
TableName sysname NULL
)
Return one row for each control to insert.
Possible value | Description |
---|---|
Center | Center aligned. |
Left | Left aligned. |
Right | Right aligned. |
Possible value | Description |
---|---|
boolean checkbox | Legacy alias. Use "checkbox" instead. |
boolean dropdown | |
chart | |
checkbox | |
Checkbox tree | |
colorpicker | |
date | |
datetime | |
dropdown | |
file | |
heading | |
heading with checkbox | |
hidden | |
html | |
info text | |
listbox | |
multi-listbox | |
multi-picker | |
multirow | |
password | |
picture | |
radio buttons | |
textarea | |
textbox | |
textbox with autosearch | |
textbox with autosuggest | |
textbox with dropdown | |
textbox with popup | |
time | |
uneditable text |
Possible value | Description |
---|---|
Default | Inherit layout from menu item. |
LabelAbove | Full width, label above. |
LabelLeft | Label to the left. |
NoLabel | Full width, no label. |
Standard | Deprecated. Use LabelLeft instead. |
Possible value | Description |
---|---|
Hyperlink | |
MailToLink | |
PhoneLink |
CREATE PROCEDURE Example.Question_MultiControl
@Id int = NULL
AS
BEGIN
SELECT
-- Name that can be used to reference the field in visibility, defaultvalue and SQL fields
'MultiControlTable' + CONVERT(varchar(100), Q.QuestionId) AS [FieldName],
Q.QuestionHeading AS [FieldLabel],
Q.QuestionId AS [Id],
Q.DefaultChoice AS Value,
-- All non dynamic field info properties should come from the field info.
123 AS FieldInfoId,
-- Any properties that needs to be set dynamically.
A.AnswerSql AS SQL
FROM
Example.Question Q
CROSS APPLY Example.Question_AnswerSql(Q.QuestionId) A
ORDER BY
Q.SortOrder;
END;
Example multicontrol procedure. In the example an input field per row in MultiControlTable will be created and if there is a corresponding value in MultiControlTable it will populate the field.
The [FieldName] column is only needed if you have dependencies.
CREATE PROCEDURE Example.MultiControlTable_MultiControl
@Id int = NULL
AS
BEGIN
SELECT
-- Name that can be used to reference the field in visibility, defaultvalue and SQL fields
'MultiControlTable' + CONVERT(varchar(100), MCTT.MultiControlTableTypeId) AS [FieldName],
MCTT.MultiControlTableTypeName AS [FieldLabel],
MCTT.Description,
-- Id value passed to InsertUpdate procedure in Id column to identify value
MCTT.MultiControlTableTypeId AS [Id],
MCT.Value,
-- Use "SQL: " an in regular field info to run a SQL statement
MCTT.DefaultValue,
MCTT.CanAllowNullValues AS [NullChoice],
-- The different field types in Softadmin are valid choices
CASE
WHEN MCTT.IsDropdown = 1 THEN
'dropdown'
WHEN MCTT.IsHeading = 1 THEN
'heading'
WHEN MCTT.IsTextbox = 1 THEN
'textbox'
END AS [FieldType],
-- SQL statement for field types that require it
MCTT.SQL,
MCTT.Height,
MCTT.Width,
-- Visibility field
CASE
WHEN MCTT.MultiControlTableTypeId = 4 THEN
'{MultiControlTable3}=="test"'
END AS [VisibleJavascript]
FROM
-- One field per row in Example.MultiControlTableType
Example.MultiControlTableType MCTT
-- Get value from Example.MultiControlTable if it exists
LEFT JOIN Example.MultiControlTable MCT ON
MCT.MultiControlTableTypeId = MCTT.MultiControlTableTypeId AND
MCT.RowId = @Id
ORDER BY
MCTT.MultiControlTableTypeName
END
The stored procedure should be named "<Schema>.<TableMultiControlGetsRowsFrom>_MultiControl".