AX1140
Creating a drop-down list based on an Axiom query
You can use the Select content tag within a Grid data source to allow users to select an item from a list generated by an Axiom query.
By default, the list of items displays as a combo box, allowing selection from a drop-down list and/or typing into the box to find a specific value. Only the first 100 items in the list display in the drop-down list, but all items can be selected by typing to search. The Select tag syntax has no effect within the source file itself, but when the file is viewed as an Axiom form, the cell containing the Select tag will render as the combo box.
Content tag syntax for Axiom query drop-down lists
The syntax for the Select content tag is as follows:
[Select; TargetCell=CellAddress; FormState=KeyName; SharedVariable=VariableName; DisplayCell=CellAddress; AQ=Sheet!AQName; ValueColumn=ColumnName; DescriptionColumn=ColumnName; DisplayFormat=Text; Placeholder=Message; MultiSelect=True/False; ReadOnly=True/False; Filter=FilterStatement; AutoSubmit=Enabled/Disabled/Grid; Tooltip=Text; ColumnStyle=StyleName; Columns=Number;]
Parameters can be listed in any order after the Select tag. Optional parameters can be omitted.
To create the tag, you can manually type it within a cell, or you can use the Data Source Assistant / Tag Editor. For more information, see Creating and editing content tags in Formatted Grids.
When using the Data Source Wizard / Tag Editor, you must specify the List Items Source as Axiom query in order to configure the tag to use an Axiom query. This selection is used to show the correct parameters for this configuration.
Parameter | Description |
---|---|
TargetCell |
The cell to place the selected value. You can specify the cell using one of the following options:
For more information, see Referencing cells in content tag parameters. The target cell cannot be the same cell that contains the Select content tag. The target cell can be anywhere in the spreadsheet and does not need to be visible within the formatted grid. If there is content in the target cell, that content will be displayed as the selected value for the combo box (unless a DisplayCell is specified). If you want to display a previously selected value that was saved to the database (such as when the form is subsequently opened and a value is queried back in), then you can use a formula in the target cell to bring in this value. NOTES:
|
FormState |
The key name under which the selected value will be stored in form state memory. For example, VPName. When a form state key name is defined, the user's selected value is not placed anywhere in the source file. Instead, it is stored in form state memory for the current file. If you need to reference the value within the form, you can use the GetFormState function to return the value into a cell. The FormState parameter should only be used if the form is intended to be used as a dialog in the Desktop ClientGeneral term for using either the Excel Client or the Windows Client, both of which are installed to the user's desktop., and you need to be able to pass values from the form to the currently active spreadsheet. For more information, see Passing values between an Axiom form and the active client spreadsheet (form state). |
SharedVariable |
The shared variable name to save the selected value as. For example, ProposalName. When a variable name is defined, the user's selected value is not placed anywhere in the source file. Instead, it is saved to the variable list that is stored in memory for the shared form instance. If you need to reference the value within the form, you can use the GetSharedVariable function to return the value into a cell. The SharedVariable parameter should only be used if the form is intended to be used in an embedded form context (as either the parent form or a child form), and you need to share this value with other forms in the shared form instance. For more information, see Sharing variables between parent and child forms. |
AQ |
The name of the Axiom query to use as the source of the list. This parameter uses the following syntax: SheetName!AQName. For example: Sheet2!AQList. See the discussion below for more details on how to set up the Axiom query. |
ValueColumn |
Optional. The table column that contains the list of values, specified using a fully qualified Table.Column name. For example: Dept.Dept. By default, the first column in the Axiom query field definition is assumed as the value column. You only need to specify the value column in the tag if it is not the first entry in the field definition. |
DescriptionColumn |
Optional. The column that contains descriptions for the value column, specified using a fully qualified Table.Column name. For example: Dept.Description. By default, the second column in the Axiom query field definition is assumed as the description column. You only need to specify the description column in the tag if it is not the second entry in the field definition and if you are not using the DisplayFormat parameter to define a custom display format. However, if you are using the DisplayFormat parameter to define a custom display format, then the DescriptionColumn parameter does not apply. Instead, you should include the description column in the custom display format as desired. |
Filter |
Optional. A filter criteria statement to limit the values available for selection. The filter impacts both what displays in the drop-down list, and what is available when searching using the filter box. When using an Axiom query as a source, you can use the filter parameter, or you can define a filter in the Axiom query settings (or both). |
DisplayCell |
Optional. The cell that contains content that you want to display in the combo box other than the selected value. You can specify the cell using one of the following options:
For more information, see Referencing cells in content tag parameters. For example, due to limited space in the grid, you may want to display the value's description in the cell instead of the literal selected value. The display cell can contain the description of the selected value (as returned via a GetData function). The display cell contents only display if a value has been selected (meaning, the target cell has content). The display cell is not meant to be a substitute for the placeholder text. |
DisplayFormat |
Optional. Defines a display format for the items in the list, and specifies additional columns to display. By default, items in the list are displayed as: KeyColumn - DescriptionColumn If you want to specify a different format and/or use additional columns, then you can indicate the display format here. Use fully qualified Table.Column syntax and place column references in curly brackets. For example, you could indicate something like: {Acct.Acct} - {Acct.Description} ({Acct.Category}) This would display account items in the following format: 8000 - Facilities (Overhead) Any column used in the display format must also be included in the field definition of the Axiom query. |
AutoSubmit |
Optional. Specifies how interactive controls submit values back to the source file:
If omitted, the default behavior is Grid. |
Placeholder |
Optional. A message to display within the combo box when no value has yet been selected. This only applies when the target cell does not have any contents, or when the form state key or shared variable does not currently have an assigned value. For example: "Select a Department." Once a value has been selected, the contents of the target cell (or the stored form state / shared variable value) display instead of the placeholder text. You can define the placeholder text within the tag directly, or you can use a bracketed cell reference to read the placeholder text from another cell. For more information, see Referencing cells in content tag parameters. NOTES:
|
Tooltip |
Optional. Specifies tooltip text to display when a user hovers the cursor over the cell contents. Alternatively, you can use a bracketed cell reference to read the tooltip text from the referenced cell. This approach is useful if you want to dynamically determine the text, because then the formula can be in the referenced cell instead needing to construct the tag using a formula. For more information, see Referencing cells in content tag parameters. |
ReadOnly |
Optional. Specifies whether the drop-down list is "active" (True/False). The default value, False, means that the list is active and that the user can select values as needed. If True, then the cell becomes "frozen" and no further edits can be made. The cell will display the current selected value of the list (or the display cell value, if applicable). This parameter can be used to control whether a user can edit the cell's value. Generally speaking, this parameter would only be used within a formula to dynamically enable / disable the combo box. |
Searchable |
Optional. Specifies whether the list is searchable (True/False). By default, this is True, which means the list is searchable by typing values into the combo box. If you want the list to be a static drop-down list instead, indicate False. If the list has more than 100 items, then the list must be searchable or else users will not be able to select all items in the list. Only the first 100 items are displayed in the drop-down list, but all items can be found by searching. NOTE: If MultiSelect is True, then this parameter does not apply. The dialog box where users can select multiple values always has a search box to filter the list. It is recommended to disable this parameter so that users cannot attempt to type inside the combo box (which will just cause the multi-select dialog to open). |
MultiSelect |
Optional. Specifies whether users can select multiple values in the list (True/False). By default this is False, which means that users can only select a single value. If True, then users can select multiple values in the list. When the user clicks on the combo box, a dialog opens instead of a drop-down list. The user can select check boxes for the values they want to select. When the user clicks OK to close the multi-select dialog, the selected values are written back to the target cell using a comma-separated list. If the values are from a string column, they are automatically wrapped in single quotation marks so that they can be used in a filter using an IN operator. The combo box in the form displays the same list, unless a display format cell is being used to change the display. For more information on how users interact with the multi-select dialog, see Multi-select dialog behavior. NOTE: If multi-select is enabled, it is recommended to define placeholder text because that text will display as the title of the multi-select dialog. |
Columns |
Optional. Specifies how many columns the cell contents will span in the grid. If this parameter is omitted or set to 1, then content generated by the tag will only span the current column. If you want the content to span multiple columns, enter a number such as 2 to span 2 columns. The column span extends to the right. NOTE: The row and column styles used in the grid impact how the column span displays. For example, if the content in the starting column is left-aligned and does not naturally exceed the width of the starting column, then the spanned columns will simply be blank because no content is extending to those columns. However, if the content is long enough to extend out of the starting column, or if the content has external borders (such as a text box), or if the content is center-aligned or right-aligned, then content will display in the spanned columns. |
ColumnStyle |
Optional. Specifies one or more column styles to apply to the current cell. The specified styles override the current column styles set by the Enter one or more valid column style names, separated by commas. If you are using the Data Source Assistant / Tag Editor, you can click the [...] button to open the Choose Styles dialog and select from available styles. The available styles depend on the skin specified for the form. For more information, see Using row and column styles with Formatted Grids. Alternatively, you can use a bracketed cell reference to read the style from the referenced cell. This approach is useful if you want to dynamically determine the style, because then the formula can be in the referenced cell instead needing to construct the tag using a formula. For more information, see Referencing cells in content tag parameters. |
Axiom query setup for use in a Select tag
When a user interacts with the combo box to select an item, the specified Axiom query is run in memory only (meaning, no values are populated within the sheet where the query is configured). The results of the query are used to populate the list.
The Axiom query should be set up as follows:
-
The first column in the field definition should be the value column for the list—meaning the values to be selected. If the value column is a key column, then the second column in the field definition should be the description column for the key values.
If for some reason you do not want these columns to be the first columns of the query, then you can use the
ValueColumn
andDescriptionColumn
parameters of the Select tag. This explicitly tells Axiom to use these columns as the value and description, regardless of where they are located in the Axiom query field definition. -
The field definition of the query must also contain any additional columns used in the
DisplayFormat
parameter of the Select tag. These columns must be placed after the key and description columns. All columns in the field definition must be contiguous (no blank cells in between). -
It is recommended to use fully qualified Table.Column names in the field definition for the Axiom query. If you define a display format for the combo box, the display format must use fully qualified columns, and they must match the corresponding field definition entries exactly.
-
The Axiom query data filter can be used to filter the list of values returned by the query. If desired, you can also (or alternatively) use the Filter parameter for the Select tag.
-
All refresh behavior options for the Axiom query should be set to Off (such as Refresh on file open, Refresh on manual refresh, etc.), unless you also want the query to run at those times for reasons other than the drop-down list.
-
No Axiom query settings that impact the display in the sheet will apply to the drop-down list. This includes spreadsheet sorting (use data sort instead), in-sheet calc method formatting or formulas, and data range filters. The only Axiom query settings read from the sheet are the field definition entries.
Tag examples
[Select; TargetCell=K23; AQ=Sheet2!AQList; Placeholder=Select Category]
This example allows the user to select from a list of categories generated by the Axiom query named "AQList" defined for Sheet2. The cell will display the text "Select Category" until a category is selected. The selected value will be placed in cell K23. Note that omitted parameters do not need to be delimited with an "empty" semicolon.
[Select; FormState=Category; AQ=Sheet2!AQList]
This example is the same as the first example, except that instead of storing the user's selection in a target cell, the selection will be stored in form state memory under the key name of Category. When the Axiom form is used as a dialog, this category value can be passed to the currently active spreadsheet file.
[Select; SharedVariable=Category; AQ=Sheet2!AQList]
This example is the same as the previous example, except that it is using a shared variable instead of form state. The selected category will be stored in the list of variables for the shared form instance, as the value for the variable Category. For example, you might do this so that the user can select a category in a parent form, and then that category can be referenced in child forms displayed using the Embedded Form component.
[Select; TargetCell=K; AQ=Sheet2!AcctList; Placeholder=Select Account]
This example displays a list of accounts, as generated by the Axiom query named "AcctList" defined for Sheet2. The first two columns of the Axiom query are Acct.Acct and Acct.Description, so that is what will display in the drop-down list. Additionally, only a column letter is specified for the target cell, so the user's selection will be placed in column K within the current row.
[Select; TargetCell=K; AQ=Sheet2!AcctList; Value=Acct.Acct; Description=Acct.Description; Placeholder=Select Account]
This example is the same as the prior example, except that in this case we have added the Value and Description parameters to explicitly tell Axiom which columns to display in the drop-down list. These parameters were added because the first two columns in the field definition are not Acct and Description.
[Select; TargetCell=K; AQ=Sheet2!AcctList; Placeholder=Select Account; Columns=2; ColumnStyle=center]
In this example, the Columns parameter is used to span the combo box across two columns, and the ColumnStyle parameter is used to apply the center style to this cell, regardless of which style is currently being applied to the column.