AX1312

Defining column views in a sheet

You can define column views in a sheet, to allow users to toggle certain columns as shown or hidden.

For example, you may have twelve months of data in a sheet and you want users to be able to show or hide these columns by quarters. You can set up these columns with column view tags, and then users can specify which quarters are currently visible in the sheet by toggling these column view tags off or on.

Column views are additive by default. Unlike sheet views, where the user must switch between one view or another, any number of column views can be active at the same time. Continuing the previous example, if a user wants to see the columns for both Q1 and Q3, they can choose to activate both of those column views at the same time. However, if desired it is also possible to configure a ColumnView tag so that only one column view within that control row can be active at a time.

Column views are defined by creating the following tags in the sheet:

  • A ColumnView tag to designate the control row for this set of column views. The tag can also be used to define an overall group name for the column views, and to optionally enforce single selection of column views.

  • Column tags to mark columns to be shown or hidden, and to define the column view names. These tags are placed in the control row.

Column view tag summary
Tag Type Tag Syntax

Primary tag

[ColumnView; GroupName; SelectionType]

Column tags

[Column; ViewName]

Defining the ColumnView tag in a sheet

To define a set of column views, place the following tag in any cell within the first 500 rows of the sheet. The row where the ColumnView tag is placed becomes the column view control row.

[ColumnView; GroupName; SelectionType]

The ColumnView tag uses the following parameters:

Item Description

GroupName

Optional. A top-level group name for all column views defined in this control row.

  • If omitted, then all view names defined in the Column tags will display directly on the Change View menu.

  • If defined, then all view names defined in the Column tags will belong to the group name. The specific behavior of the menu depends on whether the SelectionType is set to allow multiple selection or single selection. For more information, see Configuring view display on the Change View menu.

This name must be unique across all views defined in the sheet, including row views and sheet views.

SelectionType

Optional. Specifies whether the column views in this control column are additive (multiple selection), or whether only one column view can be active at a time (single selection).

  • If omitted, then multiple column views can be active at a time. This is the default behavior.
  • Otherwise, use the keyword Single to specify that only one column view (from this control row) can be active at a time.

NOTE: If you enable single-selection, then you must also define a group name. The column view names affected by the single-selection behavior are displayed underneath the group name, so that the user can understand that selecting one of these items causes the other items in the group to become inactive. The group name should attempt to make this behavior clear—for example, it should say something like "Select a Quarter to Show" versus "Select Quarters to Show."

Examples

[ColumnView]

This tag simply designates the control row for the column views. The specific names defined in the individual Column tags display directly on the menu.

[ColumnView;Show Columns]

In this example, a group name has been defined for the tag. This name will display as the first level on the Choose View menu instead of the individual column view names. The user can then select one or more column views within this group.

[ColumnView;Show a Column;Single]

In this example, the text "Single" is used in the third parameter to specify that only one column view within this group can be active at a time.

NOTES:  

  • The primary ColumnView tag must be located in the first 500 rows of the sheet.

  • ColumnView tags can be placed within a formula, as long as the starting bracket and identifying tag are present as a whole within the formula. For more information, see Using formulas with Axiom feature tags.

Marking columns to include in column views

Within the view control row, use the following tag to mark each column that you want users to be able to toggle shown or hidden:

[Column; ViewName]

ViewName defines the name that users will select to toggle this column shown or hidden. The name can also be used to apply a default column view when the file is opened.

Multiple columns in the same ColumnView control row can use the same view name so that those columns are toggled as a unit. However, the name cannot be used in any other view control.

When a column view name is toggled active, columns marked with that name are shown. When a column view name is toggled inactive, columns marked with that name are hidden. Any columns in the control row that are not marked with Column tags are unaffected by the column view.

Example

Columns D-F belong to the column view named Q1, and columns G-I belong to the column view named Q2. When Q1 is active, columns D-F are shown; when Q1 is inactive, then columns D-F are hidden. If both Q1 and Q2 are active, then columns D-I are shown. Column C is not marked with a Column tag and therefore is unaffected by the column view.

You can define multiple view names within a single Column tag, separated by commas. For example:

[Column; All, Q1]

This column belongs to both the Q1 column view and the All column view. This approach could be used in the Column tags for the previous example so that users have a way to toggle all of the quarters visible at once.

Column view behavior

When a file is opened, column views are automatically applied but inactive by default. This means that all columns that belong to a column view will be hidden (because the column views are not active). If you want to automatically activate one or more column views when the file is opened (so that the columns will be visible), you can use the Initial Dynamic Column Views setting on the Control Sheet. For more information, see Setting the default views for a sheet.

When a column view is made active—whether by default on file open, or by using the Change View command—the following occurs:

  • All columns marked with the designated column view name are shown.

    Exception: If a sheet view is also active in the sheet, and one of the columns belonging to the column view is flagged to be hidden by the sheet view, then the column will be hidden. If a sheet view and column view overlap, the Hide tag in the sheet view takes priority.

  • By default, all other marked columns in the same ColumnView control row are left as is (shown or hidden). However, if the ColumnView tag is configured as single-selection, then all other marked columns in the control row are hidden (and their associated views made inactive).

  • The Freeze Panes settings defined on the Control Sheet (if applicable) are reapplied.

When a column view is made active, the name of the column view is written to the Current Dynamic Column Views cell on the Control Sheet. Multiple active column views are separated by commas. This field is system-maintained and is used to keep track of the currently active column views so that they can be automatically reapplied after certain file processes (such as after running an Axiom query, or inserting a calc method). If the sheet is not already configured on the Control Sheet, activating a column view will cause it to be.

Multiple column views can be active at a time. All columns belonging to all active column views will be shown (unless a column is hidden by an active sheet view, as described previously).

Using multiple ColumnView tags

You can define multiple ColumnView tags in a sheet, to define different sets of column views. You might do this for the following reasons:

  • You want one set of column views to allow multiple-selection, while the other set only allows single selection. Because this is configured on the ColumnView tag, you must use multiple ColumnView tags.

  • You want to use different group names for different sets of column views. Because this is configured on the ColumnView tag, you must use multiple ColumnView tags.

  • You want a column to belong to more than one column view. However, keep in mind that you may be able to accomplish this more easily by defining multiple column view names within a single Column tag.

Although each individual ColumnView tag may be configured as multiple-selection or single-selection, if you have multiple ColumnView tags then these different sets of column views are always additive. Enabling single-selection for a particular ColumnView tag only controls the column view selections for that particular control row. The user can still select column views from other ColumnView control rows if they exist, and those columns will be shown even if they would have otherwise been hidden by the single-selection ColumnView.

NOTE: If you have multiple [ColumnView] tags in a sheet, make sure that the column view names defined in the [Column] tags are unique within each control row. All columns flagged with the same view name will be treated as belonging to the same view, even if the columns are in different [ColumnView] control rows.