Dataset Template Variables
Dataset variables are available throughout Component.Studio when working with datasets. They provide access to dataset properties and user-defined variables.
Core Dataset Properties
These variables are always available when a dataset is selected:
| Variable | Description | Availability |
|---|---|---|
| dataset.id | The unique identifier for this dataset. | Dataset Editor, Designer |
| dataset.name | The name of this dataset. | Dataset Editor, Designer |
| dataset.enumerations | An array containing the names of columns that are used for enumeration. For example: ['color', 'size']. This tells you which columns create multiple variations of each row. |
Dataset Editor, Designer |
| dataset.vars | An object containing all variables you created in the Dataset Variable Editor. Access individual variables like dataset.vars.variableName. |
Dataset Editor, Designer |
User-Defined Dataset Variables
You can create custom variables in the Dataset Variable Editor. These variables are accessible through dataset.vars and can be used for calculations that apply across your entire dataset.
| Variable Pattern | Description |
|---|---|
| dataset.vars.variableName | Access any custom variable you've defined in the Dataset Variable Editor. For example, if you create a variable called "basePrice", access it as dataset.vars.basePrice. |
game.vars.difficulty) but cannot reference row-specific data. They are calculated once for the entire dataset.
Usage Examples
Example 1: Using Dataset Name
Display the dataset name on your component:
{{ dataset.name }}
Output: "Fantasy Cards"
Example 2: Dataset Variables in Calculations
Create a dataset variable "taxRate" with value 0.08, then use it in row cells:
{{ cellValue('A1') * (1 + dataset.vars.taxRate) }}
If cell A1 contains 100, output would be: 108
Example 3: Combining Dataset and Game Variables
In a dataset variable, you can combine game-level and dataset-level logic:
{{ game.vars.globalDiscount + 5 }}
Then use this in your rows to apply consistent calculations across the entire dataset.
Context Availability
Dataset variables are available in different contexts throughout Component.Studio:
- Dataset Editor - All dataset variables are available when editing rows and cells
- Designer - All dataset variables are available when the design is linked to a dataset
- Dataset Variables - Can reference
game.varsbut not other dataset variables or row data - Rows - Can reference all dataset variables plus row-specific data
- Layers - Can reference all dataset variables when rendering with dataset context
Best Practices
- Use descriptive names - Name your dataset variables clearly like "cardBackColor" instead of "c1"
- Calculate once - Put calculations that apply to all rows in dataset variables rather than repeating them in every cell
- Centralize configuration - Use dataset variables for values that might change across the entire dataset (colors, multipliers, base values)
- Game vs Dataset variables - Use game variables for values shared across ALL datasets, use dataset variables for values specific to one dataset