accessing data
Once blocks are connected, you can access data from source blocks in destination blocks using connection tags and various data access techniques.
Basic Data Access
The simplest way to access data is through direct references using connection tags:
Simple Property
<block.content>
Nested Property
<block.tokens.total>
Array Element
<block.items[0].name>
Complex Path
<block.data.users[2].profile.email>
Advanced Data Access Techniques
Array Access
You can access array elements using square bracket notation:
// Access the first item in an array
<block.items[0]>
// Access a specific property of an array item
<block.items[2].name>
// Access the last item in an array (in Function blocks)
const items = input.block.items;
const lastItem = items[items.length - 1];Object Property Access
Access object properties using dot notation:
Dynamic References
Connection references are evaluated at runtime, allowing for dynamic data flow through your workflow:
Data Transformation
Using Function Blocks
Function blocks are the most powerful way to transform data between connections:
String Interpolation
You can combine connection tags with static text:
Conditional Content
In Function blocks, you can create conditional content based on connected data:
Handling Missing Data
It's important to handle cases where connected data might be missing or null:
Always validate connected data before using it, especially when accessing nested properties or array elements.
Default Values
In Function blocks, you can provide default values for missing data:
Conditional Checks
Check if data exists before accessing nested properties:
Optional Chaining
In Function blocks, use optional chaining to safely access nested properties:
Debugging Connection Data
When troubleshooting connection issues, these techniques can help:
Log Data: In Function blocks, use
console.log()to inspect connected dataReturn Full Objects: Return the full input object to see all available data
Check Types: Verify the data types of connected values
Validate Paths: Ensure you're using the correct path to access nested data
Was this helpful?
