Mastering Data Retrieval in Make.com: A Comprehensive Guide to Using the Set Variable Tool
Hey there, Make.com users! Today, we're going to tackle a common problem that many of us face when working with deeply nested collections. Specifically, we're going to learn how to retrieve data into a variable using the Set Variable tool. This can be a bit tricky, especially when you need to go down a few layers, but don't worry, we've got you covered!
Understanding the Problem
Let's say you have a variable called “Client Address” and you want it to have the value of “Value” under Field ID 4088061. Similarly, you want a variable called “First Time” to have the value of “Value” under Field ID 5035053. The Field IDs are consistent across all records. You've tried using the formula {{map(3.forms; “value”; “fieldID”; 5035053)}} but it returns empty. Sounds familiar? Let's dive into the solution.
Step-by-Step Solution
The solution to this problem is a bit more complex than one might initially think. The forms array has collections inside, so you'll need to iterate the array first to extract the objects you want. Here's how you can do it:
- Create a new array with the values you need using an array aggregator.
- Use the map() function on the new array you created.
Remember, the arguments to the function map() are an array and a key in the array. You don’t pass in the values unless you’re filtering using the third and fourth argument. So to get all the emails, for example, you will use something like this: Map(6.array;custom_fields). This will return all the email keys from custom_fields in an array.
Troubleshooting Tips
If you're still having trouble, here are a few things to keep in mind:
- An iterator module simply iterates the array you pass into it and runs the next set of modules with the value of each array element.
- Bundles will naturally be processed as bundles always are, one at a time by the module that generates the output bundles.
- Each output bundle will then run all the modules and the bundle contents are available individually to all the modules after the module generating the bundles.
- Think of bundles like processing a row of data with nested values possibly as arrays and collections.
Conclusion
Retrieving values from deeply nested collections in Make.com can be a bit challenging, especially for beginners. However, with the right approach and understanding of how the Set Variable tool works, you can easily navigate through the layers and retrieve the data you need. Remember to iterate the array first to extract the objects you want, create a new array with these values using an array aggregator, and then use the map() function on the new array. Happy Making!
You do have further questions?
Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.