Actions6
Increment Value by Key in Scope. Create Key if It Does Not Exist
AI-generatedOverview
This node operation increments a numeric value stored by a specified key within a defined scope in a key-value storage system. If the key does not exist, it creates the key with an initial value before incrementing. This is useful for counting occurrences, tracking metrics, or accumulating values dynamically during workflow execution.
Use Case Examples
- Increment a counter for user logins within the workflow scope.
- Track the number of times a specific event occurs during an instance's lifetime.
Properties
| Name | Meaning |
|---|---|
| Scope | Defines the scope in which the key-value pair is stored. Options include ALL scopes, Execution scope, Workflow scope, and Instance scope. |
| Key | The key whose value will be incremented or created if it does not exist. |
| Expire | Whether to set a timeout on the key, causing it to expire after a certain time. |
| TTL | The time-to-live in seconds before the key expires, applicable only if Expire is true. |
Output
JSON
incrementedValue- The resulting incremented value of the key in the specified scope.
Dependencies
- Requires access to a key-value storage service that supports scoped storage and increment operations.
Troubleshooting
- Ensure the key is a valid string and the value stored is numeric or can be incremented; otherwise, the increment operation may fail.
- If using expiration, verify that TTL is a positive integer to avoid errors.
- Check that the scope and executionId (if Execution scope is selected) are correctly set to avoid unexpected results.