Accessing deeper levels of complex array/collection

:bullseye: What is your goal?

Decompose multilayer array/collection.

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

Hello folks,

I embarked on a little fun project in order to learn Make - a Trello based Habit Tracker.
I currently got stuck on the part where I’m trying to count completed tasks to generate weekly stats.

Here is the deal…

Via Trello API I’m pulling all lists (list is a day, card is a habit/task to complete) from the give board with the cards that belong to each list This I’m then passing thru a router with 4 branches, each filtering for lists from a given week (day 1-7, 8-14 and so on) ending up with something that looks like the attached image.

At this point I need to extract the dueComplete (card completed status) from each card in order to count the TRUEs and FALSEs …and I’m stuck.

What I tried is:

{{map(133.array; “cards”)}} - it works exactly how I would wish except it only outputs one card per day (not all 3)

flatten() does not work here as this is not an array of arrays

adding a series of iterators…
first one to “open up” the array, second the cards, third the dueComplete values… kinda does the job but we step into the world of multiple and multiple operations, which I’d rather avoid.

Also… I’m not even sure how I can make a variable out of it.
Let’s say the final number of operations, after filtering the dueComplete for TRUE, equals to the number of completed cards (9 in this case)… but when I plug SET VARIABLE after this, I’m not getting 1 variable “9” - I’m getting “1” 9 times - one for each operation.

Is there a way to collapse the multi-op stream into a single op? kinda like aggregator collapses multi-bundle into a single bundle?

adding aggregator after each of the above iterators (to avoid breaking the stream into multi-ops) outputs the exact same thing that I fed into the iterator - takes me back to square one. Not sure it this is how it is supposed to work or is it a bug.

So… the question is:
How can I “decompose” the big array to end up with a simple array containing either collections of dueComplete:value, or just an array of TRUEs and FALSEs?

I do understand there are other avenues to achieve the same result and I have already thought of a few, but I’m particularly keen to understand how to deal with this kind of complex arrays/collections.

Thanks for your assistance
Marcin

:link: Create public scenario page

https://eu2.make.com/public/shared-scenario/3lw3mdB7v21/integration-trello-tools-copy

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Alright! I found the exact solution.

The whole problem was in syntax.

map(array[];cards[]) - returns only one card per day instead of all 3

vs.

map(array[];cards) - returns all cards as intended

then flatten() and map() again and I have an array of only the TRUE and FALSE values as wanted.

1 Like