# Null output

**URL:** <https://community.n8n.io/t/null-output/261>\
**Category:** Questions\
**Created:** [21 Octubre, 2019 10:02 UTC](https://community.n8n.io/t/null-output/261 "2019-10-21T10:02:27Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![mooghermez](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mooghermez/32/26_2.png) [@mooghermez](https://community.n8n.io/u/mooghermez)\
**Post date:** [21 Octubre, 2019 10:02 UTC](https://community.n8n.io/t/null-output/261/1 "2019-10-21T10:02:28Z")

</div>

Hi everybody

In my case:

- I want to add an ID to new row in google sheet.
- I generate a random ID by “function” node.
- search my table in google sheet to find that I have that generated id or not by google sheet" node.
- if there isn’t that id I create new row with that random id.

my problem is:  
after search my table in google sheet (by lookout in google sheet node) how can I use null output in “if” node.  
How can I use something like this:  
if search results = 0 then true

Update:  
I think One Option is add “empty” and “not empty” in string in “if” node.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [21 Octubre, 2019 18:59 UTC](https://community.n8n.io/t/null-output/261/2 "2019-10-21T18:59:09Z")

</div>

Sorry to hear that you have problems!

Checking for an empty item is possible like this:

---

<div class="post-metadata">

**Author:** ![mooghermez](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mooghermez/32/26_2.png) [@mooghermez](https://community.n8n.io/u/mooghermez)\
**Post date:** [22 Octubre, 2019 08:39 UTC](https://community.n8n.io/t/null-output/261/3 "2019-10-22T08:39:16Z")

</div>

Thank you @jan  
Is this just for strings or I can use it for numbers too?

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [22 Octubre, 2019 08:52 UTC](https://community.n8n.io/t/null-output/261/4 "2019-10-22T08:52:14Z")

</div>

Should work for everything. All the expression does is to check if the item returned from the node contains any data.

---

<div class="post-metadata">

**Author:** ![ZXS](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/zxs/32/1358_2.png) [@ZXS](https://community.n8n.io/u/ZXS)\
**Post date:** [1 Julio, 2020 00:50 UTC](https://community.n8n.io/t/null-output/261/5 "2020-07-01T00:50:00Z")

</div>

> [@jan](#):
>
> {{!!Object.keys($node["Google Sheets"].data).length}}

I have the following:  
`{{!!Object.keys($node["Get User"].data).length}}`  
where `Get User`, is a MySQL query that returns 0 rows.

On the Result (UI) it always says [not found]. Indead, if the query returns no results, the attribute `data` does not get created. Is there a way to check if `data` attribute exists?  
Or, what’s the best solution to test if no rows where returned?

Thank you!

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [1 Julio, 2020 05:39 UTC](https://community.n8n.io/t/null-output/261/6 "2020-07-01T05:39:38Z")

</div>

If the MySQL query does not return any rows the node after it does not executed as nodes only get executed if there is data. If you want that the next node does get executed no matter what, you can activate the option “Always Output Data” under the “Nodes” tab (next to the “Parameters” tab). Then it will make sure that at least always an empty object does get returned. Then also the above expression should work again.

---

<div class="post-metadata">

**Author:** ![ZXS](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/zxs/32/1358_2.png) [@ZXS](https://community.n8n.io/u/ZXS)\
**Post date:** [1 Julio, 2020 08:07 UTC](https://community.n8n.io/t/null-output/261/7 "2020-07-01T08:07:43Z")

</div>

Thank you!

This worked like a charm.  
All I had to do was to activate that option. I didn’t know it existed, sorry, still new here:)

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [1 Julio, 2020 08:45 UTC](https://community.n8n.io/t/null-output/261/8 "2020-07-01T08:45:36Z")

</div>

All good. Most people do not and is very hidden. For sure more our fault than yours.

---

<div class="post-metadata">

**Author:** ![ZXS](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/zxs/32/1358_2.png) [@ZXS](https://community.n8n.io/u/ZXS)\
**Post date:** [1 Julio, 2020 09:04 UTC](https://community.n8n.io/t/null-output/261/9 "2020-07-01T09:04:11Z")

</div>

No worries!

But perhaps you can consider changing the tab label. Something like “Node settings” or just “Settings”.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [30 Agosto, 2020 16:29 UTC](https://community.n8n.io/t/null-output/261/10 "2020-08-30T16:29:52Z")

</div>

Sorry totally forgot to update here. Got renamed to “Settings” a while ago.

---

<div class="post-metadata">

**Author:** ![jeanguy](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jeanguy](https://community.n8n.io/u/jeanguy)\
**Post date:** [13 Enero, 2021 06:21 UTC](https://community.n8n.io/t/null-output/261/11 "2021-01-13T06:21:50Z")

</div>

Hello,

I test n8n which I find very good.  
I want to create a workflow to search if a value exists in my google sheets (I use lookup) and if so, do nothing, otherwise add the value.

I have a problem with the “if” function. If I activate the option “always output data”, and put `{{!!Object.keys($node["Google Sheets"].data).length}}` into value 1, only the true branch is always activated.

Do you have a solution?

Best regards

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [13 Enero, 2021 09:11 UTC](https://community.n8n.io/t/null-output/261/12 "2021-01-13T09:11:06Z")

</div>

Hey @jeanguy!

Welcome to the community 🙂

In the IF node, you can select the branch for which you want to see the output. By default, it displays the output for the true branch. You can change it to false by select `false` from the _ **Output** _ dropdown list on the top of the node.

 ![Screenshot 2021-01-13 at 2.37.33 PM](https://europe1.discourse-cdn.com/n8n/original/2X/5/51096d47eb4136e6a1782f348553b46a257f2033.png)

If the false branch is still not giving an output, please share your workflow so that I can replicate it.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![jeanguy](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jeanguy](https://community.n8n.io/u/jeanguy)\
**Post date:** [13 Enero, 2021 14:16 UTC](https://community.n8n.io/t/null-output/261/13 "2021-01-13T14:16:25Z")

</div>

Thank you @harshil1712  
I don’t know how execute the false branch, when value is not in google sheets.

Please find me screen:

 ![Capture d’écran du 2021-01-13 15-14-43](https://europe1.discourse-cdn.com/n8n/original/2X/8/880071db334873e322d2d7f7c188fc4457478d5f.png)

If the value didn’t exist in google sheets, IF result is “not found” and no nod is executed.  
If I check “always output data” it is the true branch wich is executed.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [13 Enero, 2021 16:18 UTC](https://community.n8n.io/t/null-output/261/14 "2021-01-13T16:18:55Z")

</div>

How does your IF-Node look like? Can you please post a screenshot.

In this case, you should not set “Always Output Data”. As it does exactly what you describe. It will always output data to the true-branch if there is nothing for the false one. As that is not helpful in this case, there is no need to set it.

---

<div class="post-metadata">

**Author:** ![jeanguy](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jeanguy](https://community.n8n.io/u/jeanguy)\
**Post date:** [13 Enero, 2021 19:26 UTC](https://community.n8n.io/t/null-output/261/15 "2021-01-13T19:26:45Z")

</div>

This is my If node:

 ![Capture d’écran du 2021-01-13 20-25-23](https://europe1.discourse-cdn.com/n8n/original/2X/e/ed09a81b9a13f4312c7cdaa01b5de48c26d6aab4.png) ![Capture d’écran du 2021-01-13 20-25-41](https://europe1.discourse-cdn.com/n8n/original/2X/c/c9165f01cc1d96c881cc700e5180f4de977da9ee.png)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [13 Enero, 2021 20:47 UTC](https://community.n8n.io/t/null-output/261/16 "2021-01-13T20:47:39Z")

</div>

Here an example workflow with the data from the Google Sheets node mocked:

To test how it would work if data would be found you can simply remove the `//` in the Function-Node.

Having now looked into what you want to do some more you would have to activate the option “Always Output Data” but not on the IF-Node, you have to activate it on the Google Sheets node. Because if you do not set it, and no value would be found the execution would stop at the Google Sheets Node.

---

<div class="post-metadata">

**Author:** ![jeanguy](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jeanguy](https://community.n8n.io/u/jeanguy)\
**Post date:** [14 Enero, 2021 06:52 UTC](https://community.n8n.io/t/null-output/261/17 "2021-01-14T06:52:15Z")

</div>

Thank you very much, its works, even without node function.  
To be sure I understand, when value don’t exists in google sheet, outbut data is empty, and IF node test if google sheets node has data?

So what is the role of the node function?

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [14 Enero, 2021 06:56 UTC](https://community.n8n.io/t/null-output/261/18 "2021-01-14T06:56:39Z")

</div>

The Function node is just used for the example. It is not required in your use case.

---

<div class="post-metadata">

**Author:** ![jeanguy](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jeanguy](https://community.n8n.io/u/jeanguy)\
**Post date:** [14 Enero, 2021 08:59 UTC](https://community.n8n.io/t/null-output/261/19 "2021-01-14T08:59:19Z")

</div>

Ok, thank you.
