Dynamic Lookup Demo Dynamic Lookup Widgets are a powerful tool for allowing users to select values from a predefined set of options that can change based on conditions or other inputs. This guide walks through setting up and using dynamic lookup widgets.

Setup Process

1. Creating the Options Data

1

Create a Equation Widget

Start by creating a equation widget or equation widget to store your options data
2

Structure Data as a Matrix

Organize your data in a matrix format, where each option set is separated into rowsExample format: [[A,a], [B,b], [C,c]]
The Equation Widget would look like this: Options Data Setup

2. Setting Up the Dynamic Widget

1

Create the Dynamic Widget

Add a new dynamic lookup widget to your template
2

Link Data Source

In the data source field, input the ID of the equation widget you created in step 1. This ensures the dynamic widget pulls its options from the correct source
Data Source Configuration

3. Setting the Default Value

1

Select Default Value

Decide on a default value that should be presented to the user initially
2

Use matrixSubset

Use matrixSubset to select the first value from the matrix created in the equation widgetExample: matrixSubset(t_avail, 0, 0) selects the first element
Default Value Setup This formula selects the first element from the t_avail matrix to be the default value.

4. Testing and Final Adjustments

1

Thorough Testing

Test the widget extensively to confirm that values are displayed correctly according to the conditions you’ve set
2

Hide Equation Widget

Hide the equation widget to prevent user confusion and ensure a clean user interface
3

Make Adjustments

If any issues are identified during testing, make necessary adjustments to formulas, connections, or settings

Data Structure Examples

Simple Options Matrix

[
  ["Option 1", "value1"],
  ["Option 2", "value2"], 
  ["Option 3", "value3"]
]

Conditional Options Matrix

// Based on material type
material_type == "steel" ? [
  ["S275", 275],
  ["S355", 355],
  ["S420", 420]
] : [
  ["C20/25", 20],
  ["C25/30", 25],
  ["C30/37", 30]
]

Common Use Cases

Material Selection

Different materials available based on design code or region

Section Properties

Available cross-sections filtered by material or size constraints

Load Factors

Load combination factors that vary by building type

Code Parameters

Design parameters that change based on selected standard

Best Practices

  • Always provide a sensible default value using matrixSubset
  • Hide the data source equation widget to keep the interface clean
  • Test all possible conditions that affect the dropdown options
  • Use descriptive labels for both display text and underlying values
  • Consider performance impact with very large option sets
  • Document the data structure in authorNotes for future developers
Ensure your data matrix structure is consistent across all conditions. Inconsistent matrix shapes can cause errors when the dynamic lookup widget tries to process the data.

Matrix Functions

Common Matrix Operations

  • matrixSubset(matrix, row, col) - Extract specific values
  • matrixLength(matrix) - Get number of rows
  • matrixColumn(matrix, col) - Extract entire column
  • matrixRow(matrix, row) - Extract entire row

Example Implementation

// Data source widget (hidden)
material_type == "steel" ? [
  ["S275", 275, 430],
  ["S355", 355, 510] 
] : [
  ["C20/25", 20, 25],
  ["C25/30", 25, 30]
]

// Default value in dynamic lookup
matrixSubset(material_options, 0, 0)  // First option display text

// Accessing selected values in other widgets  
matrixSubset(material_options, selected_index, 1)  // Yield strength
matrixSubset(material_options, selected_index, 2)  // Ultimate strength