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.
Optimize your code by creating field information with common properties instead of assigning all properties dynamically. Reference this field information using the FieldInfo column and use dynamic field information for customizing the remaining properties.
Using FieldInfo is also helpful when you encounter properties that can only be set on field information and can't be assigned dynamically.
Return field information for the controls to insert.
Name of field information to base the dynamic field on, specified as "FieldTable.FieldName". All properties not explicitly overridden by dynamic field information will be copied from this field. The referenced field must be found in the menu item's field tables.
Allow HTML.
When set to true, it uses legacy functionality and is therefore only recommended to be used to disallow HTML. To allow HTML, it is recommended to use the FieldInfo column.
Possible value | Description |
---|---|
center | Only applicable to grid columns. |
left | |
right |
It is recommended to use FieldInfo instead.
ID of field information to base the dynamic field on. All properties not explicitly overridden by dynamic field information will be copied from this field. The referenced field must be found in the menu item's field tables.
The name of the control type to use. It is usually recommended to use FieldInfo instead unless the column is used to make fields hidden or uneditable.
Possible value | Description |
---|---|
boolean checkbox | Legacy alias. Use "checkbox" instead. |
boolean dropdown | |
chart | |
checkbox | |
checkbox tree | |
colorpicker | |
date | |
datetime | |
dropdown | |
file | |
file upload area | |
heading | |
heading with checkbox | |
hidden | |
html | Legacy alias. Use "html editor" instead. |
html editor | |
info text | |
listbox | |
multi-autosearch | |
multi-listbox | |
multi-picker | |
multirow | |
password | |
picture | |
radio buttons | |
radio cards | |
signature | |
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 |
Possible value | Description |
---|---|
default | System default. Not useful unless you are trying to override an already explicit text direction on existing field information. |
ltr | Left-to-right (for example English) |
rtl | Right-to-left (for example Arabic) |
Possible value | Description |
---|---|
150 | Medium-long |
30 | Shortest |
300 | Long |
500 | Longest |
60 | Short |
90 | Medium short |
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".