Map() returns empty array when extracting a nested array field (Relevantnost[].Name) from Array Aggregator output

:bullseye: What is your goal?

Group 16 Notion content-idea records into 3 buckets by their relevance tag (Top / Strong / Medium) using an Array Aggregator + map(), so a downstream module can randomly pick a record from the right-weighted category and auto-post it to LinkedIn/Telegram.

:thinking: What is the problem & what have you tried?

The Array Aggregator’s output is definitely correct (verified in the execution history: Array[1].Properties Value.Relevantnost[1].Name = the right tag text, for all 16 items). But every map() I write on that array to extract/filter by the nested Relevantnost.Name field returns “empty” for all items, even a completely bare, unfiltered one:

map(10.Array; 10.Array:Properties Value.Relevantnost:Name)

I tried 4 variants total: the bare one above, the same wrapped in get(…;1), wrapped in get(get(…;1);1), and the full filtered version with ifempty()+get() as the 3rd/4th map() args. All return empty for all 16 items. Ruled out an encoding mismatch (compared codepoints of the filter string vs the actual tag value in devtools - identical). Ruled out the Array Aggregator config missing the field (it’s included, and shows correctly in the output inspector).

My read: map() can’t resolve a field that’s nested two levels deep (Relevantnost is a 1-item array field inside Properties Value, which is inside the outer Array being mapped), even though the exact same path renders fine as a static value elsewhere. Is there a different syntax needed for double-nested array fields inside map(), or limitation where I should switch to Iterator + Filter + Aggregator per category instead?

:clipboard: Error messages or input/output bundles

Scenario: LinkedIn Auto-Post from Notion (ID 5621346, org 2378067, us2.make.com)
Execution log showing the empty-array output: https://us2.make.com/2378067/scenarios/5621346/logs/3d8f8585fd83428081652a2f47b3cbd5

Hello @Aleksandr_Likhachev,

Could you please send us screenshots of your scenario? How it is built and how the data structure output looks like?

You shared URLs to your workspace - we are volunteers here and do not have access to your account and can’t open these links.

Also one additional question - why not use group by in Array Aggregator?

Thanks for looking into this! Answering both questions.

Why not Group by in Array Aggregator: I actually just tested this. Enabling Group by (Advanced settings) with an expression pointing at the nested tag field on the source module works correctly at the aggregator level: it splits the 16 items into separate bundles per tag, each with a flat Key (the tag text) and an Array of matching items. So the aggregator itself resolves the nested field fine when used for grouping.

The catch: this changes module 10’s output from 1 bundle (a single 16 item array) to N bundles, one per unique tag. My downstream module (a Set multiple variables step) was built assuming a single bundle, so switching to Group by breaks it with a new error until that step is rewritten to consume multiple bundles instead. I reverted Group by for now so the scenario stays in its last stable state while I sort out the map() issue, since the two look like separate problems.

That said, this is a useful data point: it confirms the Array Aggregator can resolve the same nested path fine when it is used as a Group by key, so whatever is blocking map() from reading that path inside a mapped array expression looks specific to map’s own field resolution, not a general problem with the aggregator or the nesting depth.

Scenario setup (sorry, I could not get image uploads to attach in this session, so here it is in text).

Module 10, Array Aggregator: Source Module = Notion Search Objects (the module that queries the 16 pages), Target structure = Custom, Aggregated fields = Page ID and Properties Value, Group by = empty (reverted, see above).

Module 12, Set multiple variables: Variable 1 is named topIds, its formula is map applied to the module 10 array, mapping Page ID, filtered by Properties Value dot Relevance array dot Name equals the top tag text. Variable 2 (topTexts) follows the same pattern but maps a different text field instead of Page ID. Both return empty for all 16 items, for all 3 tag categories, even a completely unfiltered bare version of the same map call.

For reference, the data shape coming out of module 10 (confirmed via the execution history output inspector) is: each array item has Page ID as a plain string, and Properties Value as an object containing a Relevance field that is itself a 1 item array of objects with a name property holding the tag text. So the tag is nested inside a 1 item array, which is nested inside Properties Value, which is nested inside the outer array being mapped, that is the double nesting I suspect map is choking on.

Happy to try any other diagnostic you would suggest, and thanks again for the help.

If you want to pull data from a nested array, then you need nested map functions as well, not a singular one. First function pulls the nested array from the top one, wrap that in a second function that pulls the item you need from the first one. Hope this helps.

Thanks, I tried this but want to confirm the exact syntax, since two interpretations both failed.

Attempt A: nested map() inline as the outer map’s filter_key argument, e.g. map(10.Array[]; 10.Array[]:Page ID; map(10.Array[]; 10.Array[]:Properties Value.Relevance[]:Name); “Strong”). This throws a hard error: “Failed to map ‘2.value’: Function ‘map’ finished with error! ‘{array}’ is not a valid key for filtering.” Make evaluates the inner map() into one whole array and rejects using it as a per-item filtering key.

Attempt B: single flat map() with the top-level array as the collection, i.e. map(10.Array[]; 10.Array[]:Page ID; 10.Array[]:Properties Value.Relevance[]:Name; “Strong”) - this is actually the original formula from my first post. No error this time, but still empty, even for a record I can directly confirm has the matching tag in the Array Aggregator’s own output inspector.

I also checked whether the Array Aggregator’s “Aggregated fields” selector could add a pre-flattened custom field, so the tag would be a flat sibling of Page ID with no nesting at all - but that field list only offers whole source fields, not custom expressions.

Could you show the literal formula you had in mind for “wrap that in a second function that pulls the item you need from the first one”? Specifically: does “first function” mean a separate variable or module producing a flat array (not an inline nested call), which the second map() then references by name? That is my best guess at this point, but wanted to confirm before restructuring the scenario with an extra module. Thanks again for your patience.

Hello @Aleksandr_Likhachev I really appreciate your effort but it is extremely hard to help you debug something based only on descriptions. We dont have any reference data or scenario to work on.

Can you prepare at least sample JSON? Change private data and hopefully we will be able to suggest solution.

Fair - here is a sanitized but structurally faithful sample of what map() is actually working with (real field names/shape, placeholder text and URLs, IDs randomized). This is the raw output of module 10 (Array Aggregator), one array item per Notion record:

[{“id”:“aaaa1111-b222-c333-d444-e5555f666777”,“properties_value”:{“Relevance”:[{“id”:“0664bb42-8a4e-4fe0-a2a6-38df060550d4”,“name”:“Strong”,“color”:“orange”}],“Status”:{“id”:“9401252f-1e9e-4f01-abf2-818c2cab1426”,“name”:“Approved”,“color”:“green”},“Source”:“https://example.com/article-one","Post text”:[{“type”:“text”,“text”:{“content”:“Sample post paragraph one.”,“link”:null}}],“Title”:[{“type”:“text”,“text”:{“content”:“Sample title one”,“link”:null}}]}},{“id”:“bbbb2222-c333-d444-e555-f6666g777888”,“properties_value”:{“Relevance”:[{“id”:“1775cc53-9b5f-5df1-b3b7-49ef171661e5”,“name”:“Top”,“color”:“red”}],“Status”:{“id”:“9401252f-1e9e-4f01-abf2-818c2cab1426”,“name”:“Approved”,“color”:“green”},“Source”:“https://example.com/article-two","Post text”:[{“type”:“text”,“text”:{“content”:“Second sample post paragraph.”,“link”:null}}],“Title”:[{“type”:“text”,“text”:{“content”:“Sample title two”,“link”:null}}]}}]

The formula I am applying against that array, using the field names from the sample above: map(10.Array[]; 10.Array[]:Page ID; 10.Array[]:Properties Value.Relevance[]:Name; “Strong”)

Result: empty array, even though item 1 in the sample clearly has Relevance = “Strong”.

I also tried wrapping the nested path in its own map() call and using that as the filter_key argument (my interpretation of “wrap that in a second function”): map(10.Array[]; 10.Array[]:Page ID; map(10.Array[]; 10.Array[]:Properties Value.Relevance[]:Name); “Strong”). That throws a hard error instead of returning empty: “Failed to map ‘2.value’: Function ‘map’ finished with error! ‘{array}’ is not a valid key for filtering.” So Make evaluates the inner map() into one whole array and rejects using it as a per-item filtering key, rather than pairing it up item-by-item with the outer array.

Could you show the literal formula you had in mind for “wrap that in a second function that pulls the item you need from the first one”? My best guess at this point is that “first function” has to be a separate variable or module producing a flat array (not an inline nested call), which a second map() then references by name - but wanted to confirm before restructuring the scenario with an extra module. Thanks again for your patience.

Welcome to the Make community!

Combining Map & Get (or First) functions to get Values from Arrays

The built-in functions map, get, first (or `last) allows you to access values within an array containing collections.

First, use the map function on an array, which returns another array of filtered values —
map(array; key; [key for filtering]; [csv-values for filtering])

Then, the built-in function get (or first/last) to get a specific, single item from the resulting array —
get(array; path)

You will get something that looks like these —

{{ get(map(array; "value"; "name"; "content-type"); 1) }}
{{ first(map(array; "value"; "name"; "content-type")) }}

Map Function Parameters: Step-by-Step

To easily remember how to use each of the parameters of the map function, think of it this way:

  1. From this array (of collections),
  2. I want to get all the the values for the property/key named _______,
  3. Where another property/key _______
  4. has the exact case-sensitive value _______

Example

1. From this array (of collections) user_column_data

2. I want to get all the the values for the property/key named string_value

3. Where another property/key column_id

4. has the exact case-sensitive value EMAIL

5. Output

e.g.:

{{first(map(10.array; "id"; "properties_value.Relevance.1.name"; "Strong"))}}

:high_voltage: Make Input Markup: Copy-paste the above into the field, including start/end curly brackets for it to import as intended :warning:

image


For more information, the documentation for the above functions can be found in the Help Centre and the “Mapping with Arrays” link below. You should also complete the tutorials in the Make Academy, especially Using get() and map() functions as this is the most important knowledge you need to understand so that you can successfully apply it when building scenarios using Make.

Module Subflow Export - paste modules into your scenario

Copy and paste this into the scenario editor to import the example modules shown in my screenshots above.

{"subflows":[{"flow":[{"id":251,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"{ \"array\": \n[{\"id\":\"aaaa1111-b222-c333-d444-e5555f666777\",\"properties_value\":{\"Relevance\":[{\"id\":\"0664bb42-8a4e-4fe0-a2a6-38df060550d4\",\"name\":\"Strong\",\"color\":\"orange\"}],\"Status\":{\"id\":\"9401252f-1e9e-4f01-abf2-818c2cab1426\",\"name\":\"Approved\",\"color\":\"green\"},\"Source\":\"https://example.com/article-one\",\"Post text\":[{\"type\":\"text\",\"text\":{\"content\":\"Sample post paragraph one.\",\"link\":null}}],\"Title\":[{\"type\":\"text\",\"text\":{\"content\":\"Sample title one\",\"link\":null}}]}},{\"id\":\"bbbb2222-c333-d444-e555-f6666g777888\",\"properties_value\":{\"Relevance\":[{\"id\":\"1775cc53-9b5f-5df1-b3b7-49ef171661e5\",\"name\":\"Top\",\"color\":\"red\"}],\"Status\":{\"id\":\"9401252f-1e9e-4f01-abf2-818c2cab1426\",\"name\":\"Approved\",\"color\":\"green\"},\"Source\":\"https://example.com/article-two\",\"Post text\":[{\"type\":\"text\",\"text\":{\"content\":\"Second sample post paragraph.\",\"link\":null}}],\"Title\":[{\"type\":\"text\",\"text\":{\"content\":\"Sample title two\",\"link\":null}}]}}]\n}"},"metadata":{"designer":{"x":4090,"y":-346,"name":"Array Aggregator [10] "},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":252,"module":"util:SetVariables","version":1,"parameters":{},"mapper":{"variables":[{"name":"output","value":"{{first(map(251.array; \"id\"; \"properties_value.Relevance.1.name\"; \"Strong\"))}}"}],"scope":"roundtrip"},"metadata":{"designer":{"x":4334,"y":-346}}}]}],"metadata":{"version":1}}
Need help❓View instructions ◀

1. Move your mouse over the line of code above.
Copy the JSON by clicking the copy button on the right-side:

2. Enter your scenario editor. Close any open panels by pressing ESC. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

3. Click on imported modules and re-save it to trigger validation. There may be some errors prompting you to re-map some variables and select connections.

Note: Did you know you can also reduce the size of blueprint exports and module subflows like the above, using my Make Blueprint Scrubber?

@samliew

Thanks so much @samliew — your tip on combining map() with get()/first() and the exact syntax example was exactly what I needed. Turned out my scenario had two more gotchas on top of that (a real space character hiding between the emoji and text in my select option names, and the plain_text field sitting one level shallower than I assumed), but once those were sorted the formula pattern you described worked perfectly. Scenario is now running end-to-end successfully. Really appreciate you taking the time to write such a clear explanation!

One follow-up question, if you or anyone else has run into this: after everything worked, the exact same scenario failed again on its next scheduled run with the identical “Invalid array” error. When I re-exported the blueprint, the map() formulas in that Set-multiple-variables module had silently reverted to a broken/mangled form (quoted literals like “id” got auto-converted into bracket-notation pill references like 10.array[].id, semicolons turned into +, etc.) even though I never touched that module again after saving it correctly. This has now happened twice.

Is there a known way to “pin” or lock a formula so Make’s editor/backend stops re-normalizing it into a broken form on its own? Or is repeatedly re-importing a corrected blueprint really the only reliable workaround? Would appreciate any pointers - trying to avoid babysitting this scenario after every scheduled run.

The first thing I would check is the actual array path coming out of the Array Aggregator. In Make, map() returns an empty result when the mapper is pointed at the parent object or when the field name does not match the bundle structure.

I would add a temporary JSON or log step, confirm whether Relevantnost is an array of collections, and then map the exact Name field from that array. If the aggregator emits multiple bundles, aggregate or iterate at the correct level before calling map().

Also check whether Name is consistently present in every item. One missing or differently named field can make the result look like a mapping problem when it is really an input-shape problem.