Extract an Item from Array | Get and Map Function | Make Beginners Guide

Are you a beginner? Learn in just 10 mins how to extract an item from an array based on a label using Get() and Map() functions.

23 Likes

This is one of the more important data manipulation techniques to learn. Well done.

2 Likes

Brilliant stuff Jahar :purple_heart:

Thank you so much for creating the video and for sharing it with the community. The get-map function is often a life-saver so the more folks know about it the better!

2 Likes

WOW this is so helpful!!! Thank you so much!!

I have been trying to learn Iterators and Arrays and got close, but wasn’t using the map function, I was using the iterator to extract values from arrays and then using Set Variables.

Going to try it this way. Thanks again, looking forward to more!

2 Likes

Thanks for the feedback. Please feel free to comment on our video as well

3 Likes

Check out our Masterclass program on arrays and collections here:

-:rocket:Now easily Learn Array & Collection with our :red_circle:Recorded Masterclass for just $25 (first 20 users)

Duration: 60 Mins

Buy now at https://www.msquare.pro/masterclass-handle-array-collection

Promo Code: LEARNARRAY25

4 posts were split to a new topic: Filtering based on date

OMG I cant believe there’s a class on this! Just bought it, can’t wait to dig in and looking forward to future courses!! Thank yoU!

@optimal_prime
We have received your request. We shall send the recording soon.

1 Like

:rocket: Automate your workflows with ease using Make (formerly Integromat)! Our latest blog post covers everything you need to know about using the get() and map() functions. :computer::mag: Learn how to simplify complex data handling and increase productivity. Check it out now! :point_right::memo: https://www.msquare.pro/post/how-to-use-the-get-and-map-functions-in-make-formerly-integromat-to-automate-workflows #workflowautomation #productivitytips #Maketools #Integromat #automationtools

1 Like

Hi, thank you for sharing. One question: What about when you need to get and map function for sub arrays? (an array inside an array?) ie , need to retrieve number 55555555555 under “id”: 363024, “key”: “_wc_shipment_tracking_items” on this example?

 "metaData": [
        {
            "id": 331866,
            "key": "is_vat_exempt",
            "value": "no"
        },
        {
            "id": 331867,
            "key": "_wpm_process_through_wpm",
            "value": "1"
        },
        {
            "id": 363024,
            "key": "_wc_shipment_tracking_items",
            "value": [
                {
                    "trackingProvider": "XXXXXXXX",
                    "customTrackingProvider": null,
                    "customTrackingLink": null,
                    "trackingNumber": "55555555555",
                    "dateShipped": "1679443200",
                    "trackingId": "111d902c2adc67074b"
                }
            ]
        }

best regards,

1 Like

You are feeding an array with just 1 array element in metaData array, so get() or map() won’t work since they work best on an array with multiple array elements. To be more precise get() will be able to just select the first array element because there is only one in your array, or it can select metaData.value array but it won’t search it. map() won’t work either since there is only one array element and filtering will work on an array with multiple elememts.

What you have here is an array with a bunch of collections in it so it is best to simply iterate the array with the array iterator, filter and then select the item you need out of the iterator using a filter.

When I try to work with data structures I like to isolate the structure into a Parse JSON module which effectively generates the necessary output bundle(s) that I can work with. I simply wrapped your array structure in { and } to create a JSON structure:

The Parse JSON module you can see generates just 1 bundle with an array with 1 array item and 3 collections inside of it. The iterator simply iterates the array and each collection becomes a separate bundle that can now be filtered and treated individually.

Next I simply filter on the id in the module path to the next module, Set Variable.

This module sets the variable to what I want to extract out of the matching bundle that was filtered

Yielding the necessary result:

I am attaching the blueprint for you to experiment with on your own.
blueprint (8).json (5.3 KB)

Remember: get() and map() work on arrays and complex arrays with MULTIPLE array elements, NOT arrays with 1 array with multiple collections.

1 Like

I followed your tutorial step by step but I still ended up with no data. I’m using calendly to capture data btw. can anyone help?

Hi @Xavier_Caffrey

Please share more details of the mapping you have done.

Alternatively, if you are looking for any consultation, feel free to book a slot from the below calendar link:

Msquare Automation
:point_right: Visit our website | :spiral_calendar: Book a free consult