Displaying values in SET challenge

Describe the issue/error/question

Flow not displaying any data unless both functions have values.

What is the error message (if any)?

I am trying to display 2 separate values in a SET, but issue is that CL0 function not always runs because of an IF, so some times it basically has no results. due to this most of the times only CL1 function has values, but if both don’t have values the SET will not run, how is it possible to set that it will always run the SET if CL1 has values? Thank you very much.

Please share the workflow

Information on your n8n setup

  • **n8n version:**0.177.0
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Jorge_M, if you want to make sure your workflow always progresses, regardless of whether a node returns data or not, you’d want to enable the always output data setting on your node:

image

This way, the execution wouldn’t stop if a node returns no data.

That said, this example workflow looks odd for another reason. If you want your Set node to return only a single item rather than two separate items, you might want to consider building it sequentially like so:

Hi @MutedJam ,
Thanks a lot for the swift reply. I did do the Always output data, but didn’t work (I guess due to paralel). I did it in a parallel because there is a fork of actions with a switch, one that process data with certain location and the other same but different location.

Is it not good practice parallel flows?

So there’s nothing wrong with parallel flows if you know which data they return. You’ll then be able to merge your branches and avoid having multiple items leading to unexpected behaviour.

However, in your example workflow no merging takes place, so the behaviour would be different depending on which branch runs first. This can be avoided with a sequential flow where nodes simply run from left to right.

Thanks @MutedJam, but by putting CL1 in front of CL0, it seems it is displaying the item length of the CL0 in CL1 (Gives always 1 as result) and not from the previous actions/flows I have before (These are 2 http get requests).

image

But that’s what your Function code does: Reading the length of the incoming items array. Is that not what you want?

This is what I am trying to achieve (just a mockup as the length will give 1 for both):

There are 2 get requests, then I have the 2 functions to count the items in the HTTP array, then would like to have a SET that shows total and both separate values, so in this case:

Total = 15
CL4 = 5
CL5 = 10

But since CL4 most of times does not run, it was giving the issue of not running the last “SET”

Hi @Jorge_M, okay I think I see where you’re going, but I am not sure how the execution would stop after the CL4 Function node (as long as the HTTP Request node before your CL4 Function node has the “Always Output Data” setting enabled).

Any chance you can share the actual JSON data passed on to your CL4 Function which causes the workflow to stop? Feel free to redact the actual values if there’s any confidential data involved, I am just interested in the data structure.

Hi @MutedJam ,
I can try to replicate without confidential data, before the CL4/0 and CL5/1 there are POST requests. But issue here happens actually when CL4 does not execute due to lack of requests since the IF didn’t match the condition, so all actions after don’t run, this is when actually the data does not work. Originally I was trying to just use the: {{$node[“CL4”].json[“results”]

  • {{$node[“CL5”].json[“results”] }}}} in the “Total” of the set action, but it was only running fine when both CL4 and CL5 had results, so meeting both “IF” conditions.

So in your screenshot it seems the XanoPost3 HTTP Request before the CL0 Function node (equivalent to CL4 in your previous example from what I understand) didn’t get any data to start with. Meaning the Always Output Data option can’t take effect here. So you’d need to check where exactly your flow stops and prevent that from happening.