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 FieldInfoId column and use dynamic field information for customizing the remaining properties.
Using FieldInfoId is also helpful when you encounter properties that can only be set on field information and can't be assigned dynamically.
The alignment of grid columns and InfoSQL values.
Possible value | Description |
---|---|
center | Only applicable to grid columns. |
left | |
right |
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. |
JavaScript that controls the mandatory status of the field, this overwrites nullchoice if set. This is only available to control types for which the mandatory JavaScript field is visible in the user interface.
Possible value | Description |
---|---|
Hyperlink | |
MailToLink | |
PhoneLink |
Which direction the script is written in. Not to be confused with the CellAlignment property.
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) |
The width of the control.
At one point, this was a pixel value. Back when Softadmin used Verdana 10px, and before fields had width-categories. Now, it is just a value that is converted to a width category.
The possible values listed below are just suggestions. For example, both 1 and 30 will be converted to shortest, and both 500 and 9999 to longest.
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".