Describe the problem/error/question
I have a list node containing two lists, and I’m using an “if” condition to compare the “database_tech” field values from the list with a set node value.
However, the issue is that it only displays the first comparison value, and I’m not obtaining the full set of values.
In the shared workflow below, it should display two items, but it’s only showing one, specifically the first item in the matching data.
Please assist me on this
What is the error message (if any)?
No Error Message
Please share your workflow
Information on your n8n setup
- n8n version: Version 0.225.2
- Database (default: SQLite): -
- n8n EXECUTIONS_PROCESS setting (default: own, main): own
- Running n8n via (Docker, npm, n8n cloud, desktop app): : docker
- Operating system: Ubuntu 22.04.2 LTS
@Asuwini_P , not sure if I understood you right. It sounds like you do not have a problem with the workflow but rather look for a tip how to check the result for the 2nd item in the incoming list. If that is the case, then it is possible indeed.
I will demonstrate it with screenshots below. For this to work, you need to switch to Table view and hover your mouse over the item of your interest.
Is that what you were looking for?
Thank you for your response @ihortom ,
If I test with simple data, it works fine, but for my workflow, it is not working. I have shared a screenshot of this.
Here is my workflow,
I retrieve data from the MySQL node and connect it to an “if” node to verify whether the data exists or not. If the data doesn’t exist, a message is sent to Slack. In case the data exists, it proceeds to another “if” node to compare the “database_tech” with a set node value.
Set Value is depends on the Switch case,
This is a sample workflow, Please check
@Asuwini_P , it could help if you provided a copy of your workflow rather than screenshots. Moreover, the screenshots you showed seems to be dis-joined. So, it is hard to make sense of what you are actually comparing and in which node.
I just say this for now. To be able to get a value from some node other than immediately preceding and connected one, you still need to make sure the node the output of which you are trying to grab has a connection to this node one way or the other. Moreover, the order of execution is significant. You need to make sure that when you are trying to grab a value from some of the other nodes, that node has already executed.
Here’s just a rough example of what I think you are trying to do and how to achieve that.
Note that I engaged Merge node which should fix your problem (the way I understood it). Here’s what happens.
You want to compare the set of items from previous nodes with the items from MySQL call. That is where Merge node is important to be able to compare the items from both flows. As the number of the items in both sets likely to differ I use Multiplex compare in Merge node.
Note that IF cannot be used to compare two separate sets, it is used to check an individual item. That is the reason for the problem you face. Once we merged the two sets, now IF can be used.
Note that I used “Rename Keys” node. This is just to be able to compare the values in IF node following the merge in Switch.
Run that example and examine the outcome of Switch and IF nodes. Once you understood how both work here, you should be able to adapt this approach to your own workflow.
PS. There is yet another way by utilizing “Compare Datasets” node. However, that could be harder to comprehend and I’m not sure how your datasets looks like exactly to be certain this node would be a better option.