I’ve created a scenario in which I’m using DeBank API to get the info about list of wallets, then I want to analyze this info with ChatGPT module.
What is the problem & what have you tried?
In this scenario I’m using iterator, which as a result makes 14 operations with 1 bundle in each operation(each bundle holds the info i need).
I want to create a JSON which would aggregate all bundles from these 14 operations from the iterator.
For that I did Array Aggregator, but as a result it also makes 14 operation with 14 JSONs, and if I connect ChatGPT module after it, it just gives me 14 prompts, when I need one which would analyze all aggregated info.
To sum up: the problem is that after iterator I somehow need to have a module which would as a result have 1 operation with all previous operations (and bundles in it) from the iterator.
( Also, I put the last iterator as a source module in the Array Aggregator)
Or if there is other way to analyze info from those 14 operations in one prompt in ChatGPT - I’m open to try!
Exactly. That iterator is processing 14 incoming bundles, not creating 14 new bundles. Change the source to whichever module is creating the extra bundles.
Again, the last iterator did not create 14 bundles. It processed 14 existing bundles. There is nothing to aggregate there.
The iterator before only processed 3 incoming bundles, yet the one after it ran 14 times. Meaning the iterator before it is the one that creates the new bundles. So you need to put that one as the source module. Or even before that - the search module processes one incoming bundle and the iterator after it is processing 3. So that one also created new bundles and maybe this is the source module you want to go back to. Depending on what each module is producing as output.
My current problem is that Aggregator makes the same amount of operations as the source module in it and I need only one operation in Aggregator as a result.
So change the source module to the Search module at the beginning of the scenario. That’s the first module that ran only once and produced extra bundles.
Also, it looks like iterator 20 and iterator 22 aren’t actually doing anything. The idea of an iterator is when you have an array of items, the iterator module would break it down and give you a separate bundle for each item in the array. Looking at the amount of bundles produced, only iterator 6 is doing that.
Every result/item from some module types (like Trigger / Iterator / List / Search / Match modules) can potentially and likely output more than one bundle. These multiple bundles will individually run subsequent modules once per bundle, which is not optimal in most cases:
one operation per bundle per module, which could lead to…
use of multiple credits per bundle per module (some modules use more than one credit)
View example screenshots
Aggregator Example
The “Search Rows” module runs one time, returning 999 results (999 bundles).
Without Aggregator: the tools module run 999 times (999 operations)
This can easily use your entire quota of credits if you are not careful or fail to understand this concept.
To “combine” multiple bundles into a single variable, so that you can process all of the items in a single operation, you’ll need to use an aggregator. Aggregators is a type of module that accumulates bundles and outputs one bundle (unless you are using “Group By”). An example of a commonly-used aggregator module is the Array aggregator module.
You can find out more about some other aggregator modules here:
Question: Which is the best aggregator do you think you’ll need for your use-case?
Mapping a Complex (Collection) Structure Into an Array Field
The Array Aggregator module is very powerful because it allows you to build a new complex array of collections that matches a later module’s array field to map multiple items (collections) to it. Such fields initially may allow you to manually add individual items, but toggle the “Map” switch on, and you can map an array variable (from an Array Aggregator) containing multiple collections.
Simply select the respective “Target structure type” in an Array Aggregator module.
As you can see from the above example, the “Map” toggle on complex fields are used when you have an array variable (like from an array aggregator).
Note:
Other combinations of modules may also allow you to generate an array that matches a future module field’s array structure, like “Aggregate to JSON + Parse JSON”, or “Create JSON + Parse JSON”, but this is an advanced topic.
Question: Are you mapping your array into a field that accepts more than one item/collection?
Example
Here is an example of how your scenario could look like: This is just an example. Your solution may or may not look like this depending on requirements and actual data.