Selecting correct array for an iterator after making Notion API call

What are you trying to achieve?

Selecting correct array for an iterator after making Notion API call

Steps taken so far

I’ve managed to make a Notion API call that has retrieved the data I’m looking for. I now need to pass that data through an iterator. The data I need is within a text array that is contained within another results array.

In the iterator module, I can’t seem to drill down and access the text array directly - it only lets me select the results array.

Is there an additional step I need to take to access an array within an array? Or have I taken an incorrect approach entirely? Any assistance is greatly appreciated.


You could try to use this function in the Iterator input: {{map(22.body.results; “paragraph”)}}

Thanks for your quick help! You’ve definitely put me on the right path. The output of the iterator is now a bundle containing the text array. I think I need to drill down a level further, but haven’t quite figured it out. Ideally I would like the output of the iterator to be the content of the text array, not the text array itself. So the output should be 9 bundles. 1 per collection within the array. Any assistance is much appreciated!

Update:
I have progressed this slightly, by adding an additional iterator. This might not be the best practice as I’m not having a new issue.
The additional iterator outputted the 9 bundles - but I can’t seem to reference the content of those bundles in subsequent modules. As I have done in other iterators. The difference here is that it seems to be outputting a value, where my previous iterator outputted text.


Got it - then, in the first Iterator, you may try this function:

{{map(flatten(map(map(22.body.results; “paragraph”); “text”)); “plain_text”)}}


2 Likes

Thank you again! You’ve saved me several hours of head scratching and brought me one step closer to what I’m trying to achieve.

I now have the output I require using a single iterator, which is great. I tweaked the function you shared, to remove the outer map function as I don’t want to format all the bundles as plain text. Here’s what I used if it’s helpful to anyone else:

{{flatten(map(map(22.body.results; “paragraph”); “text”))}}
newfunction

I need to keep the page mentions in their original format so that I can find their Page ID for subsequent modules. This brings me to the issue I ultimately keep coming back to. I can’t access this data in subsequent modules.
The data I need:

What I can access:

I have tried map and get here but neither gave me access to the data. Just in case, I also tried with and without the extra map to plain text function and that did not change the outcome.

Any insight on where I’m going wrong is much appreciated!

Hi @DMCG36 ,

Welcome to Make Community!

We have a solution for you. Please check the below notes and images.
First of all, download the output bundle from the iterator.


Paste the Copied output inside the Parse JSON module as shown below.

Then map the items to the required fields from the Parse JSON Module.

Please copy the mapped item and paste it into a notepad it will be like this {{7.name}} now you can edit the 7. to 5. (The module number of iterator ).
So in this case you will have to change the mappings to {{5.name}} then you copy this and paste it in the required field.
Once you map everything you can simply delete the JSON module.

Please check the below loom for more clarity: Integration Jotform | Make - 5 July 2024 | Loom

2 Likes

This did it, thank you. I knew there was a way to manually map the correct value but couldn’t get the syntax right. Parsing the JSON to get the right information, did the trick. Thank you again!

1 Like