I have process that works well (shared below), it takes a list of companies, loops through each one after doing a google search to find the company’s ceo and writing it to a google sheet.
I want to add a step that uses openai to check if it thinks the ceo google returned is correct. If it is, continue and write to sheets then move onto the next company, if not to loop and try the second returned search from google.
The second loop is really screwing it up, after the second IF I seem to lose the data I want to hold and loop through in the Code node (if ceo not found) and it and it also seems to then break the original working loop.
Any help or pointers to a similar problem (with a worked solution) much appreciated!
It sounds like you are losing some of the data from the if statement. Any fields that you want to pass through the if statement need to be included. Pass the field as json field exists, so the if statement still works.
If you are still having trouble, add your json in a code block so I can download the workflow.
Nested loops wouldn’t work with default settings. Better to use a sub-workflow instead (move all the loop part inside a new workflow and call the workflow).
I have this kind of setup, I’m just unsure of the syntax to define the field name in the Workflow Input Schema (first node of sub-flow) and also how to be sure or define the right data is being past from the Execute Workflow node in the parent?
Define the fields in the trigger node (sub workflow), shich you will need. Then save the workflow. After that your execute workflow node in the parent workflow will contain the placeholders to fill
It’s the Code node that’s causing the issue, I’ve been looking in the wrong place.
What I still don’t understand though is why does it appear that the input from the Find the Contact node (main workflow) does not appear to get sent to the first node on my sub-workflow ?
It really wasn’t clear to me how you had to establish the variables in the sub-flow node (and map) in order to accept them.
The bigger revelation was that you can only see the data being passed in the input and output if you go into the “view sub-execution” view via the main workflow Execute Workflow node – I could then see all of the executions and the schema/table/JSON being in and output.