---
url: /services/workflow/data-manipulation.md
description: >-
  Transform, filter, and aggregate workflow data using FEEL expressions for
  variables, strings, numbers, comparisons, and arrays.
---

# Data Manipulation in Workflows

Data manipulation is a crucial aspect of workflow management, allowing users to transform, filter, and aggregate data as it moves through various stages of a workflow.
This document outlines the key concepts and techniques for effective data manipulation within workflows.

### FEEL Expressions for Data Manipulation

Kipu Quantum Hub workflows use [FEEL (Friendly Enough Expression Language)](https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/) for data manipulation.
Here are the most common expressions you'll use:

#### Accessing Variables

```javascript
variableName                               // Access a variable
object.property                            // Access nested property
array[1]                                   // Access array element (0-indexed)
get or else(variableName, "DefaultValue")  // Provide default value if variable is not defined
```

#### String Operations

```javascript
"Hello " + name          // Concatenate strings
string(value)            // Convert to string
upper case(text)         // Convert to uppercase
lower case(text)         // Convert to lowercase
```

#### Number Operations

```javascript
count(array)             // Count array elements
sum(numbers)             // Sum array of numbers
5 + 3                    // Addition
10 * 2                   // Multiplication
```

#### Comparison Operations

```javascript
value > 10               // Greater than
value < 5                // Less than
value = 10               // Equals (single =)
value != 10              // Not equals
```

#### Logical Operations

```javascript
condition1 and condition2 // Both conditions true
condition1 or condition2  // At least one condition true
not condition             // Negate condition
```

#### Working with Arrays

```javascript
[1, 2, 3]                    // Create array
array[1]                     // Access element
count(array)                 // Array length
for i in array return i * 2  // Transform array
```

#### Creating Objects

```javascript
{
    "key": value,              // Using variable value
    "name": "literal"          // Using literal string
}
```

#### Working with Secrets

You can request to inject a secret value into a `$secrets` input variable mapping by using the `secret_value` function.

```javascript
{
    "ibm_token": secret_value("field_name_in_json_input")
}
```

#### Common Patterns

**Referencing workflow variables** (no quotes):

```javascript
flightRoutes                 // Variable from Start Event or previous task
```

**Literal values** (with quotes for strings):

```javascript
"binary"                     // String literal
1000                         // Number literal
true                         // Boolean literal
```

**Nested property access**:

```javascript
quantumMapping.routes        // Access 'routes' inside 'quantumMapping'
map_output.id               // Access 'id' inside 'map_output'
```

**Building complex objects**:

```javascript
{
   "id": datapool.id, 
   "ref": "datapool",
   "timestamp": now()
}
```
