How to Extract an Item from an Array in Make
Have you ever found yourself struggling with array manipulation in Make? You’re not alone! Arrays are fundamental data structures, and extracting specific items from them is a crucial skill for any Make user. In fact, according to recent developer surveys, array operations are among the most commonly performed data manipulations in automation workflows. Whether building complex scenarios or simple automation, understanding array extraction techniques will significantly boost your Make proficiency.
Let’s dive into the various methods to extract items from arrays in Make!
What is an Array?
An array is an ordered list of values stored together. Each item in the array has a position (index) starting from 1 in Make. Arrays can contain numbers, text, objects, or even other arrays. They help automate workflows by organizing data efficiently. For example, an API response may return a list of customers, which you can process using an array.Arrays are essential in automation because they allow data to be easily accessed, filtered, and manipulated. Functions like map() and get() help work with arrays by extracting or modifying specific values for better automation in Make.
What is map() function?
The map() function in Make processes each item in an array, transforming or extracting specific values. It applies an operation to all elements and returns a new modified array. For example, if you have a list of users with names and ages, map() can extract only the names or increase all ages by 5. It simplifies data handling by avoiding manual selection and processing.This function is useful when working with lists from APIs or structured datasets. map() helps automate repetitive tasks efficiently, making workflows dynamic, scalable, and easier to manage in Make. If you want to learn in-depth about map() function and easy practical examples, you can visit this article The Ultimate Guide to Data Mapping in Make
What is get() function?
The get() function retrieves a specific item from an array based on its position. Since Make starts indexing from 1,get(array; 2)
will return the second item. For example, if you have a list of colors [“red”, “blue”, “green”], using get(colors; 2)
will return “blue“. It’s useful for selecting specific values from structured data like API responses, form submissions, or reports. Unlike map(), which processes the entire array, get() focuses on a single element. This function simplifies automation by providing precise control over data extraction in workflows.
Practical Examples: Using map() and get() Functions in Make
Let’s start with the basics – you’ll need some JSON data. Feel free to use my example if you’re following along! First, we’ll import the JSON parsing module and load our data.
JSON
{
"personalInfo": {
"fullname": "David Brown",
"firstName": "David",
"lastName": "Brown",
"age": 43,
"birthDate": "1981-05-15",
"email": "david.brown@example.com",
"phone": "+1-303-555-0123",
"social": {
"linkedin": "linkedin.com/in/davidbrown",
"github": "github.com/dbrown-data"
}
},
"professionalInfo": {
"role": "Data Scientist",
"title": "Senior Data Scientist",
"department": "Analytics",
"yearsOfExperience": 15,
"skills": {
"programming": ["Python", "R", "SQL", "Scala"],
"frameworks": ["TensorFlow", "PyTorch", "Spark"],
"tools": ["Docker", "Git", "Kubernetes"]
},
"certifications": {
"aws": [{
"name": "AWS Certified Data Analytics",
"issueDate": "2023-06-15",
"expiryDate": "2026-06-15",
"credentialId": "AWS-DA-123456"
}],
"google": [{
"name": "Google Professional Data Engineer",
"issueDate": "2023-02-10",
"expiryDate": "2025-02-10",
"credentialId": "GPD-789012"
}],
"microsoft": [{
"name": "Microsoft Certified: Azure Data Scientist Associate",
"issueDate": "2023-09-20",
"expiryDate": "2025-09-20",
"credentialId": "MCADS-345678"
}]
},
"workPreferences": {
"remoteWork": "HYBRID",
"availableToTravel": true,
"preferredWorkingHours": "9AM-5PM MST",
"desiredSalaryRange": {
"min": 120000,
"max": 160000,
"currency": "USD"
}
}
},
"location": {
"city": "Denver",
"state": "Colorado",
"country": "United States",
"timezone": "America/Denver",
"relocationWilling": true
},
"languages": [
{
"language": "English",
"level": "Native",
"certificates": ["TOEFL: 118/120"]
},
{
"language": "German",
"level": "C1",
"certificates": ["Goethe-Zertifikat C1"]
}
],
"personalInterests": {
"hobbies": ["Woodworking", "Photography", "Hiking"],
"pets": [
{
"type": "Dog",
"breed": "Golden Retriever",
"name": "Max"
},
{
"type": "Cat",
"breed": "Maine Coon",
"name": "Luna"
}
],
"volunteering": {
"organization": "Code.org",
"role": "Programming Mentor",
"since": "2020"
}
},
"surveyResponses": {
"technicalPreferences": {
"favoriteLanguage": "Python",
"preferredDatabase": "PostgreSQL",
"preferredCloud": "AWS",
"preferredIDEs": ["PyCharm", "VS Code"]
},
"workStyle": {
"remotePreference": "HYBRID",
"teamSize": "5-10",
"managementStyle": "Agile"
}
},
"metadata": {
"lastUpdated": "2024-02-12T14:30:00Z",
"profileVersion": "2.0",
"completionScore": 95
}
}
Next up, we’ll need to bring in our variable module. This module will help us organize our functions and keep everything running correctly
1. map() Function
Let’s clarify our goal before we use the map() function. In this case, we’re specifically interested in extracting information about English language proficiency levels from our data.
Running our scenario, we get our first result – ‘native’ as the English language level. This tells us we’ve successfully extracted exactly what we were looking for!
2. get() from map() function
Now, let’s find out what other languages this person speaks. We’ll use two steps here:- First, we’ll use map() to create a list of just the languages from our data array
- Then, we’ll use get() to pick out the second language from that list
Let’s look at what our scenario did: we used map() to collect all languages, then get() picked out just the second language for us :
And there we have it – our scenario successfully found the second language: German!
3. get() Function
Next, we will discover this developer’s second-choice IDE (Integrated Development Environment). Just like everyone has their favorite text editor and a backup option, we want to extract the second IDE from an array
- First, pass in your array of data to the get() function
- Then, specify position number 2 to fetch the second item – remember, we use 2 here because we’re targeting that specific position in our list!
And voilà! Let’s look at what our scenario returned. This is where we get to see if our get() function did its job correctly. Would you like to share the actual result so we can discuss what we found?
How Can These Functions Help You in Make?
Arrays are essential in automation, and functions like map() and get() make working with arrays much easier in Make. These functions improve efficiency by automating data extraction and transformation, reducing manual effort.- Handling Large Data Efficiently
If you receive a large dataset (e.g., a list of orders from an e-commerce site), manually picking and processing each item would be time-consuming. map() helps extract only the required details (like order IDs), while get() helps retrieve specific items (like the most recent order). - Simplifying Data Processing
APIs and integrations often return JSON data in array format. Instead of writing complex rules to filter and retrieve needed values, map() and get() allow you to process data dynamically. - Automating Workflows
Suppose you’re automating a customer support system. map() can extract ticket IDs from a response, and get() can pick the highest-priority ticket. This speeds up response times and ensures efficient task execution. - Reducing Errors
Manual data extraction can lead to mistakes. Automating the process with map() and get() ensures accuracy, especially when dealing with large datasets. - Improving Workflow Flexibility
These functions allow you to build dynamic workflows that adapt to changing data. Whether working with lists, reports, or structured datasets, map() and get() provide control and efficiency.
Conclusion
Now you have a solid understanding of extracting items from arrays in Make! Remember that practice makes perfect, and don’t hesitate to experiment with different methods to find what works best for your specific use case. Start implementing these techniques in your workflows today, and you’ll significantly improve your automation efficiency!
FAQs
How to extract an element from an array?
Use the get() function in Make and specify the position of the item you want.
How do you get an item out of an array?
Apply get(array; position) to retrieve a specific element from the list.
How to fetch an element from an array?
Use get() to pick an item or map() to extract multiple values.
How to retrieve data from an array?
Use map() for multiple values or get() for a single item in Make.
Further Ressources
- How to Do Web Scraping in Make
- How to Build an Automated Time Tracking System on Make
- The Ultimate Guide to Data Mapping in Make
- How to Automate Google Reviews with Make
- How To Handle Errors In Make: A Complete Guide
- How To Use Variables in Make
- How to Automate Invoice Processing with Make
- What Are Make’s Data Iterators & Array Aggregators? Full Guide