Push
Adds an element to the end of an array.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Array - The array to add an element to. If null, a new empty array will be created.
- Value - The element to add to the end of the array. Can be any data type.
Outputs
- Array - The modified array with the new element added to the end.
How It Works
The Push node adds a new element to the end of an array. When executed, the node:
- Receives an array through the Array input (or creates a new empty array if null)
- Receives a value through the Value input
- Appends the value to the end of the array
- Returns the modified array through the Array output
- Handles thread-safe operations when working with Global or Flow scope variables
Requirements
- Value input can be any data type: string, number, object, array, or boolean
- If the array is null, a new empty array is automatically created
Error Handling
This node is very forgiving and handles edge cases gracefully:
- If the array is null, it creates a new empty array automatically
- Any value type is accepted and added to the array
- No specific error conditions exist for this node
Usage Examples
Example 1: Collect Scraped Data
Build a list of scraped products:
- Initialize empty array:
{{flow.products}}=[] - For each product on page:
a. Scrape product details →
{{msg.product}}b. Push{{msg.product}}to{{flow.products}}c. Updated array stored back to{{flow.products}} - Result: All products collected in
{{flow.products}}
Example 2: Build Task Queue
Create a queue of tasks to process:
- Array:
{{flow.taskQueue}}=["Task1", "Task2"] - Value:
"Task3" - Push → Result:
["Task1", "Task2", "Task3"] - New task added to end of queue
Example 3: Accumulate Search Results
Collect results from multiple searches:
- Initialize:
{{flow.allResults}}=[] - Perform search 1 → get result object
- Push result to
{{flow.allResults}} - Perform search 2 → get result object
- Push result to
{{flow.allResults}} - Continue for all searches
- Result: Array containing all search results
Example 4: Build Dynamic List
Create a list based on conditions:
- Initialize:
{{msg.filteredItems}}=[] - Loop through source data
- For each item:
a. Check condition (e.g., price < 100)
b. If condition is true, Push item to
{{msg.filteredItems}} - Result: Array containing only items that meet criteria
Example 5: Log Activity History
Track user actions in sequence:
- Initialize:
{{flow.activityLog}}=[] - When user performs action:
a. Create log entry:
{"action": "login", "time": "2024-01-15 10:30"}b. Push entry to{{flow.activityLog}} - Each action is appended to the history
- Result: Chronological log of all activities
Example 6: Aggregate Data from Multiple Sources
Combine data from different sources:
- Initialize:
{{flow.aggregatedData}}=[] - Query database 1 → get records
- For each record, Push to
{{flow.aggregatedData}} - Query database 2 → get records
- For each record, Push to
{{flow.aggregatedData}} - Result: Combined data from all sources
Tips for Effective Use
- Auto-initialization: If array is null, Push creates a new empty array automatically
- Any value type: Push accepts strings, numbers, objects, arrays, and booleans
- Thread-safe: Safe for Global and Flow scopes in parallel executions
- Use in loops to collect data iteratively
- Combine with conditional logic to build filtered lists
- More efficient than Concatenate for adding single elements
- Store the result back to the original variable to maintain state
- Perfect for building lists dynamically during automation
- Use with Pop to implement stack (LIFO) behavior
- Use with Shift to implement queue (FIFO) behavior
Common Use Cases
- Web scraping data collection (adding each scraped item)
- Building filtered lists based on conditions
- Creating task queues for sequential processing
- Accumulating results from multiple API calls
- Logging activities and events chronologically
- Building dynamic dropdown options
- Collecting form inputs across multiple steps
- Aggregating data from multiple sources
- Creating lists for batch processing
- Implementing queue and stack data structures
Difference Between Push and Concatenate
| Operation | Push | Concatenate |
|---|---|---|
| Adds | Single element | Entire array |
| Position | End of array | End of array |
| Input type | Any value | Array only |
| Use case | Adding one item at a time | Merging two arrays |
| Example | Add one product | Merge two product lists |
Integration Examples
Example: Web Scraping Loop
1. Initialize: {{flow.products}} = []
2. For each page:
a. Navigate to page
b. Get product elements
c. For each product element:
- Extract product data → {{msg.productData}}
- Push {{msg.productData}} to {{flow.products}}
d. Go to next page
3. Result: {{flow.products}} contains all products from all pages
Example: Conditional Data Collection
1. Initialize: {{flow.validItems}} = []
2. Get source data → {{msg.allItems}}
3. For each item in {{msg.allItems}}:
a. Check validation criteria
b. If valid:
- Push item to {{flow.validItems}}
c. If invalid:
- Skip item or log error
4. Result: {{flow.validItems}} contains only valid items
Example: Multi-Source Data Aggregation
1. Initialize: {{flow.combinedData}} = []
2. Source 1:
a. Query API 1 → get results
b. For each result, Push to {{flow.combinedData}}
3. Source 2:
a. Query API 2 → get results
b. For each result, Push to {{flow.combinedData}}
4. Source 3:
a. Read from database → get records
b. For each record, Push to {{flow.combinedData}}
5. Result: {{flow.combinedData}} contains data from all sources
Example: Stack Implementation (LIFO)
Push (add to stack):
1. Get current stack: {{flow.stack}}
2. Push new value to stack
3. Update {{flow.stack}}
Pop (remove from stack):
1. Get current stack: {{flow.stack}}
2. Pop → get last value
3. Process the value
4. Update {{flow.stack}}
Result: Last-In-First-Out behavior
Example: Queue Implementation (FIFO)
Enqueue (add to queue):
1. Get current queue: {{flow.queue}}
2. Push new value to queue
3. Update {{flow.queue}}
Dequeue (remove from queue):
1. Get current queue: {{flow.queue}}
2. Shift → get first value
3. Process the value
4. Update {{flow.queue}}
Result: First-In-First-Out behavior