A Variable table allows you to create, view, and edit variable information in the current Part Studio or Assembly. The Variable table is located on the right side of the graphics area with the Configuration panel, Appearance panel, and Custom tables.

Use the Variable table to create variables and change the value of a variable, even when the variable is used in a feature.

See Variable Table (Assembly) for information using a Variable table from an Assembly tab.

Using a Variable table

The Variable table icon is located on the right side of the graphics area:

  1. Click Custom tables icon to the right-side of the graphics area (below the View cube):

    Variable table icon outlined in red to show where to access the table

    1. The Variable table panel opens with the Variable table ready for input:

      Variable table shown with no variables added yet

  2. (Optional) From the dropdown at the bottom of the panel, select Create Variable Studio to Create a new Variable Studio or Insert Variable Studio to insert an existing Variable Studio from this or another document:

    Insert and Create Variable Studio options

    Variable Studios inserted from other documents create references to those documents, and are read-only in the inserted table.

    When inserting a Variable table or variable from another document, the other document must have a version that contains the variable. If no version exists, you are prompted to create one before proceeding:

    Insert Variable Studio from other documents

  3. Type a name for the variable in the Name field and press Enter (or tab). The Variable name must be a FeatureScript identifier: starting with a letter or underscore followed by alphanumeric characters or underscores, and without spaces.

    A variable type and value appear. (Click in the Name cell to change the name, if necessary):

    Example of the Variable table with a variable entry

  4. Select a type, and enter a value. You can also (optionally) enter a description.

  5. Repeat as necessary to create all the variables you need.

You can also edit variables, changing variable type and value:

  1. Click the down arrow beside the Variable type for a given variable: select a new type and supply a new value. Each entry is saved:

    Example showing where to click in the Variable table to access the dropdown list for the Variable type column

    Exmple showing the new Variable type for the variable entry

To add another variable, type a name in the field labeled "New variable name" and supply the required type and value.

Variable table options

Click the ellipsis to the top right of the table to access the following options (options vary depending on whether or not the Variable Studio or variables are created or inserted — referenced — from this or another document):

Ellipsis to access Variable table options

  • Copy table - Copies the table to the clipboard. Paste and edit the data in a spreadsheet program outside Onshape, copy the data from the spreadsheet to the clipboard, and paste the data from the clipboard back into the Variable table cells or rows.

  • Header rows are read only. The Copy table command copies them to the clipboard, but data cannot be pasted into them from the clipboard.

  • Switch to Variable Studio [x] - Opens the current table's related Variable Studio tab.

  • Open linked document - Opens the document that contains the originating Variable Studio.

  • Update linked document - Opens the Reference manager to change the Variable Studio reference to a different version within the same document or a different document.

  • Move up / down - Moves the table above the previous table in the panel or below the next table in the panel, respectively.

  • Edit reference - Opens the Update Variable Studio dialog where an alternate Variable Studio can be selected as the reference.

  • Remove reference - The Variable Studio reference is removed; the table is deleted and removed from the panel.

Variable table context menu

Right-click on a Variable table cell to access the variable's context menu:

Part Studio Variable table context menu

  • Filter feature list - Locates a specific variable in the Feature list (and any features the variable affects). The Feature list displays the selected variable and all features affected by the variable.

  • Delete - Delete the variable and remove it from the table.

  • Move up/down - Move the variable row to a new location, up or down by one row.

Tips

  • When creating a variable using the Variable feature, the variable does not appear in the Variable table unless the variable is a FeatureScript identifier with a valid name: starting with a letter or underscore, followed by alphanumeric characters or underscores, and without spaces.

  • To locate features related to a specific variable in the Variable table, hover over the variable in the table and the Variable feature and all features using the variable are highlighted in the Features list:

    Example to show when hovering over a variable in the table, all Features using that variable are highlighted in the Features list

  • Variables defined in the same Variable table must have unique names. Attempting to create a variable from the table with the same name as another cancels the operation and a message alert informs you that the variable is not overwritten.

  • If a variable with the same name exists in two different tables in the panel, the variable in the last table takes precedence, and the variable in the above table is overridden. An override icon is placed next to the variable name in the above table:

    Overwritten variable

  • Creating a variable in the Features list with the same name as a variable in the table overrides the variable in the table; the table variable displays the override icon.

  • If you change a variable name in the Variable table, all Features that refer to the variable will be updated to reflect the change.