Hi - I want to return the count of each Status per Audience.
For example, I would like to return how much Mail has been sent to companies A, B or C, …
So for the following JSON, it would return 2 “Visit Profil” for Company_A, 1 “Visit Profil” for Company_B, 1"Mail sent" in Company_A, etc.
@djangelic : I’ve solved it … there was a " " in the JSON Payload
Now, my concern is more about: How can I loop through every single parameter from my IF node ?
In this case they are 2 : Audience name and Status …
The idea is to have a clear status for every existing and new audience
Awesome! Good job! I’m on mobile right now but I’ve been meaning to put together a video on looping that explains the process. I’ll try to post that in a bit. If not I’ll send you a mock-up of the process instead.
It’s possible using Nodes, I didn’t have time to put together a video but instead here is a mockup using my sheets to show you how it’s done. Delete the Loop Values node and replace it with whatever nodes you want to run within the loop, and delete the Loop Complete node, as that’s just telling you that the loop finishes here.
Please note that my mockup will not work in the desktop version. Just delete the function node at the beginning (Pretend I’m google sheets) and replace with your google sheet node instead.
Also open the nodes, and check the settings for more details as to what each node is doing and how.
Thanks for your reply. I’ve tried many times, but it seems not to work despite your explanations, but I’m sure I’m not far from the truth
From a global point of view, I understand your logic as follows: Read the GSheet > Set up the conditions with the IF node > Iterate over each value > Set up which value to loop into > Check if the iteration was done successfully.
Besides, why don’t you consider the first part of the Workflow as we need to count the items?
Here are my two majors problems :
1- “Iterates Values” - get this error message
Act as input value does not exist, but I don’t know why?
2- “Loop value here” - I’m unsure which data I need to consider here. To me, It would have to make sense to add the GSheet node as I wanted to iterate through every audience and every status
Thank you @djangelic this is exactly what I need.
Super useful and the logic is clear to me.
In the longer term, the only thing is that I will generate > 100 companies over time. Do you think I’ll need to create a No Operation node every time I have a new company in my Workflow, or do you see another way to use this Workflow at scale?
The first chunk so to speak was to extract a list of companies from your example array consisting of objects. So for this I’d then find out how to extract specific values from an array of objects (that’s what .map() does here, transforming each value in an array on the fly - in this case from a nested object to a simple string).
The next step was then to remove duplicates, cause you typically want only one entry for each company. That’s something the Item Lists node could help with, but since I expected code to be required anyway I skipped using a separate node for this here and went with creating a unique_audiences array based on a Set (which is a storage for unique values) using the Spread syntax. At this stage I have my “unique company list”.
Now this might sound complex and like I have just learned these things at some point, but full disclosure, that’s not the case . So I typically search for the correct syntax or method when required (e.g. the first result for getting unique values from an array was this one, which lists some solutions). I’ve shared my go-to reference here, but any search engine of your choice will do the job as well.
So tl;dr I don’t have any great advice on learning JS unfortunately (it’s been quite a while since my college days and we focused on other languages back then). I just tried to transfer familiar concepts as good as possible (which worked out well so far).
I do however know that @BlueRabbit3 was thinking about working through a free JS course recently, maybe she already has some initial feedback and can share the course she was looking at?