Cosmocloud Build Documentation
DocumentationTutorials
  • Welcome to Cosmocloud
  • Getting Started
    • 1. Organisations
    • 2. Projects
    • 3. Connect your Database
    • 4. Create Database Models
    • 5. Create APIs
    • 6. Testing Free Tier APIs
  • Free Tier
    • Connecting with MongoDB Data APIs
  • Templates
    • CRUD APIs
    • Entity Search APIs
    • Fetch / Upload Media APIs
  • Examples - How To?
    • Making an external API call
    • Reusable Flows - SubFlows
    • Creating Custom Error Responses
    • Flow Builder - Building Conditional Logics
    • Flow Builder - Utilising Loops
    • Creating Dynamic Queries
    • Accessing Auth Tokens in APIs
    • How to upload/download media in Object Storage
  • Resources
    • APIs
      • Checking Logs
    • SubFlows
    • Models
      • Building Models
    • Environments
      • Environment Tier Types
    • Secrets
      • Custom Secrets
    • Databases
    • Releases
    • Vector Search
      • Create a Vector Search Index
      • Edit a Vector Search Index
      • Delete a Vector Search Index
    • Document Search
      • Full Text Search
        • Concepts
          • Indexing in full-text search
          • Data processing using Analyzers
        • Create a Search Index
        • Creating a Custom Analyzer
        • Full Text Search FAQ
      • Vector Search
    • Object Storage
  • Flow Builder
    • Node Types
      • Trigger Nodes
        • HTTP Response
      • Conditional Nodes
        • If Else
        • If Else V2
        • Switch Case
      • Crypto Nodes
        • PBKDF2 Hmac Hash
      • Debug Node
      • Database Nodes
        • Delete One
        • Delete Many
        • Fetch By ID
        • Find One
        • Find Many
        • Insert One
        • Insert Many
        • List Records
        • Run Aggregation Pipeline
        • Update One
        • Update by ID
        • Update Many
      • External Nodes
        • Fire Events (SQS)
        • API Call
        • Delete storage objects
        • Execute SubFlow
        • Get Presigned URL
        • Post Presigned URL
        • Send EMAIL (SES)
        • Send SMS (SNS)
      • Loop Nodes
        • For loop
        • While loop
      • Variable Nodes
        • Arrays
          • Append array
          • Contains
          • Check array empty
          • Extend array
          • Get Array Item
          • Length of array
          • Reverse array
          • Sort array
        • Date and Time
          • Set current datetime
        • Strings
          • Append String
          • Concat Strings
          • Convert to String
          • Length of String
          • Slice String
          • Split String
          • String Operations
          • To Lower
          • To Upper
          • Trim String
        • Mathematical
          • Add Variable
          • Complex Math Expr
          • Decrement Variable
          • Divide Variable
          • Increment Variable
          • Multiply Variable
          • Subtract Variable
        • JSON
          • Build JSON Object
          • Merge JSON Objects
          • Object to String
          • Update JSON Object
        • Special
          • Build Map
          • Set Variable
          • Exists Check
    • Node name
    • CQL - Cosmocloud Query Language
      • Building Expressions
        • $abs
        • $add
        • $addDate
        • $arrayElemAt
        • $avg
        • $buildDateTime
        • $buildMap
        • $ceil
        • $cond
        • $divide
        • $floor
        • $getDay
        • $getHour
        • $getMinute
        • $getMonth
        • $getSecond
        • $getYear
        • $ifNull
        • $max
        • $min
        • $mod
        • $multiply
        • $pow
        • $subtract
        • $sqrt
      • Building Conditions
        • Compound Operators
          • $and
          • $or
        • Conditional Operators
          • $eq
          • $gt
          • $gte
          • $lt
          • $lte
          • $neq
      • Magical Autocomplete
  • Advanced Guide
    • Configuring Authentication
      • SSO Providers
        • AWS Cognito
      • Authentication Concepts
    • MongoDB Query Language
      • Limitations
    • Performance Considerations
      • Instant Deployments
  • User Management
  • Billing and Payments
    • Billing Portal
  • Help & Support
  • References
    • Change log
    • Available Cloud & Regions
Powered by GitBook
On this page
  • Properties Panel
  • Usage
  • Behaviour
  • Supported Data Types
  • Returns
  • Example
  • Best Practices
  1. Flow Builder
  2. Node Types
  3. Variable Nodes
  4. Special

Set Variable

Set Variable node is designed to create a new variable or update an existing one within your workflow. This node allows you to specify the variable's name, type, and value, providing a flexible way to manage data throughout your flow.

Properties Panel

Field

Description

Required

Node name

true

Name of variable

The name of the variable to be set or updated.

true

Type

The data type of the variable (String, Integer, Float, Boolean, Object, or Array).

true

Value

The value to be assigned to the variable.

true

Usage

  1. Specify the name of the variable you want to set or update.

  2. Select the appropriate data type for the variable.

  3. Enter the value you want to assign to the variable.

Behaviour

  • The node creates a new variable or updates an existing one with the specified name.

  • The value is converted to the specified data type before assignment.

  • For Object and Array types, the value should be a valid JSON string.

  • If the type conversion fails, the node will raise an error.

Supported Data Types

  • String: Text values

  • Integer: Non-decimal numbers

  • Float: Decimal numbers

  • Boolean: True/False values

  • Object: JSON objects

  • Array: JSON arrays

Returns

The node sets or updates the specified variable in the flow's context. You can access this variable using Magical Autocomplete (e.g., $.variables.<variable_name>) in any node below this node.

Example

Let's say you want to create a variable to store a user's age:

  1. Set Variable Name to user_age

  2. Set Variable Type to Integer

  3. Set Value to 25

This will create an integer variable named user_age with a value of 25 which can be accessed by $.variables.user_age.

Best Practices

  • Be careful when setting Object or Array types - ensure the value is a valid JSON string. For example, {"hello": "world"}

  • For complex objects or arrays, consider using a JSON formatter to ensure valid syntax when entering the value.

  • Remember that variables set with this node are accessible throughout the rest of the workflow, so plan your variable names to avoid conflicts.

PreviousBuild MapNextExists Check

Last updated 9 months ago

Node name