Skip to main content
All CollectionsArdoq FundamentalsThe Basics of Ardoq
Reactive Fields: Instant Calculations for Faster Analysis
Reactive Fields: Instant Calculations for Faster Analysis

Visualize real-time insights with dynamically calculated fields based on your component data.

Diana Nechita avatar
Written by Diana Nechita
Updated over a week ago

Reactive fields introduce a new way to calculate field values in Ardoq, using simple arithmetic or lookup tables. See the impact of your changes in real-time – no more waiting for calculations to run! These instant calculations are perfect for common use cases within a single component where real-time results are essential.

For example, when assessing risk, you could configure a reactive field so that when you update the Risk of an application from "Low" to "High," the associated Risk Level number (e.g., from 1 to 3) is updated immediately, supporting your visualizations. Similarly, in an Application Portfolio Management context, you could use a reactive field to instantly see the impact of updating an application's Functional Fit on its overall Business Value.

Table of Contents

What are Reactive Fields?

Reactive fields provide a dynamic way to display and update values within a single component, based on other fields in that same component. They offer a simpler, more immediate alternative to Gremlin-based calculated fields, updating instantly and offering ease of use. However, it's important to note that reactive fields are more limited as they cannot traverse references between components. Think of them as calculations confined to a single component.

Reactive fields are currently supported for fields of the following types:

  • Text

  • Number

  • List

Creating a Reactive Field

To create a reactive field, follow these steps:

  1. Open a workspace from the Home page.

  2. Next, open the sidebar menu (☰) on the right.

  3. Navigate to the "Workspace" tab > "Manage Field Types".

  4. Click "Add Field" and select an existing field or type in a new name and hit enter to create a new field.

  5. Choose the field type as text, number, or list from the 'Type' dropdown.

  6. Select the "Reactive" option from the radio button menu.

7. Define the Reactive behavior

Once "Reactive" is selected, specify the operation to be applied when a change occurs on the component or reference. For a comprehensive overview of all available operations and their corresponding input field types, refer to the "Reactive Field Operations and Input Types" section.

8. Then, specify to which components and reference types in the workspace the reactive fields should apply.

9. Finally, select the "Create" button. The reactive value calculation occurs with a short delay (1-2 seconds) after a change is made.

Reactive Field Operations and Input Types

This section covers the core operations available for Reactive Fields, categorized by field type, and their corresponding input field types. You'll also find information on how to combine these operations effectively to create more complex calculations.

Available Operations for Each Field Type

Field Type

Operation Available

Input Field Types

Text

Dictionary Lookup

Number, Text, List

Concatenate Fields

Number, Text, List, Ardoq ID, Ardoq OID

List

Dictionary Lookup

Number, Text, List

Number

Dictionary Lookup

Number, Text, List

Math Expression

Number

Detailed Operation Descriptions

1. Dictionary Lookup

The "Dictionary lookup" option allows you to create mappings between different values. This is useful for translating or converting values based on your specific needs and the types of your "from" and "to" fields. You can define the mapping rules within the dictionary lookup configuration. For example, you could map "Low," "Medium," and "High" levels to numerical values 1, 2, and 5, respectively.

2. Concatenate Fields

The "Concatenate fields" operation combines the values of multiple fields into a single text string. It supports number, text, list, Ardoq ID, and Ardoq OID field types as input. For instance, you might concatenate a "First Name" field and a "Last Name" field to create a "Full Name" field.

3. Math Expression

The "Math expression" option enables you to use simple arithmetic operations to combine values from other number fields within the same component or reference. To reference a value from another field, begin with the "@" symbol and then select the desired field from the dropdown suggestions. For example, you could create an expression like @functional_fit + @technical_fit to calculate a composite score.

The following elements are supported in math expressions:

  • Numbers: Integers (e.g., 10, -5) and decimals (using a period "." as the decimal separator, e.g., 3.14, -0.5).

  • Fields: References to other number fields (e.g., @my_field, @another_field).

  • Operators: + (addition), - (subtraction or negation), * (multiplication), / (division). The minus sign (-) can also be used as a unary operator to negate a field (e.g., -@my_field).

  • Parentheses: () for grouping and order of operations (e.g., (2 + 3) * 5).

Formulas can be arbitrarily complex and nested as long as they use only these building blocks.

Tips for Advanced Calculations

  • Chaining Operations with Intermediate Fields: For complex calculations, it's often helpful to break them down into smaller, more manageable steps using intermediate fields. This allows you to "chain" multiple operations together. Say for instance that you have list fields for probability and impact and you wish to calculate risk. You would then create numeric probability and numeric impact which would map high, medium, low to 3, 2, 1 for instance. You can then create numeric risk which is multiplying the two other numeric fields and finally risk which maps 1, 2 and 3 to low, 4, 5 and 6 to medium, etc

  • Handling Empty Fields in Math Expressions: When performing calculations with fields that might be empty, using intermediate fields with default values is essential. Say you have a numeric rating field which you want to calculate on, but some components doesn't have it filled out. If you create a reactive field rating or default with the math expression @rating and default value 0, you can then use @rating_or_default in another math expression. If the rating is empty, the math expression using @rating_or_default will still get a value, unlike the empty result it would have if it was using rating directly

Scenarios Support

Unlike calculated fields, reactive fields are supported within Scenarios, making them a powerful tool for "what-if" analysis.

Frequently Asked Questions (FAQ)

What are the key differences between Reactive Fields and Calculated Fields?

While both reactive and calculated fields derive their values from other fields, they have some differences:

  • Scope: Reactive fields operate within a single component or reference, while calculated fields (using Gremlin) can traverse relationships between components. This means calculated fields can pull data from related components across your model, while reactive fields are limited to the data within the current component or reference.

  • Performance: Reactive fields update near-instantly, while calculated fields are scheduled to run every hour and also may have a longer update time, especially with complex queries. The near-instant updates of reactive fields are ideal for real-time feedback.

  • Complexity: Reactive fields are limited to simple dictionary lookups and math expressions, while calculated fields offer the full power of the Gremlin graph query language. This makes calculated fields much more powerful for complex data manipulations.

When should I use Reactive Fields vs. Calculated Fields?

Choose reactive fields for simple, local calculations within a single component where real-time updates are crucial. For more complex calculations involving related components or more sophisticated logic, calculated fields are the better choice.

Who will benefit from Reactive Fields?

Reactive fields are perfect for workspace administrators who need quick, on-the-spot calculations within a single component.

Did this answer your question?