# "Only when" condition in action

**URL:** <https://forum.bubble.io/t/only-when-condition-in-action/126373>\
**Category:** Need help\
**Created:** [December 18, 2020, 7:53am UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373 "2020-12-18T07:53:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amauryguthmann](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@amauryguthmann](https://forum.bubble.io/u/amauryguthmann)\
**Post date:** [December 18, 2020, 7:53am UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373/1 "2020-12-18T07:53:55Z")

</div>

Hi,

I put an “Only when” condition on my user log in action. The idea is to test if an user exists with the filled email address and test if the request’s result is \> 1 .

But the request return 0 even if the user with the corresponding email address is within the data base.

 ![Capture d’écran 2020-12-18 084954](https://us1.discourse-cdn.com/bubble/original/3X/5/b/5b265a644d00e44b7cafa6aa0434b97c4f45d419.png)

Any idea ?

Thanks and regards.

---

<div class="post-metadata">

**Author:** ![SerPounce](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/serpounce/32/62068_2.png) [@SerPounce](https://forum.bubble.io/u/SerPounce)\
**Post date:** [December 18, 2020, 8:01am UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373/2 "2020-12-18T08:01:20Z")

</div>

Your only when is where the user count \> 1. How could this ever be true?  
But why do you need this\>? The standard log in checks should suffice, no?

---

<div class="post-metadata">

**Author:** ![pork1977gm](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/pork1977gm/32/245627_2.png) [@pork1977gm](https://forum.bubble.io/u/pork1977gm)\
**Post date:** [December 18, 2020, 8:02am UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373/3 "2020-12-18T08:02:28Z")

</div>

Yep exactly what I was going to say, greater than or equal to 1 is what you need, or IS 1

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [December 18, 2020, 11:43am UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373/4 "2020-12-18T11:43:27Z")

</div>

As the above posts say, if you’ve only got 1 user that matches a given email address (which presumably you have), then having a condition ‘only when user count’ is more than 1 will obviously fail, as you don’t have more than 1 user with that email address.

For it to work you’d need to use: \>0 (more than 0), or ‘is’ 1.

Although, as mentioned above, I’m not sure what the point of that condition would be on a log in action, as you obviously can’t log a user in if they don’t have an account in the first place, so there’s really no need in using such a conditional there.

---

<div class="post-metadata">

**Author:** ![amauryguthmann](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@amauryguthmann](https://forum.bubble.io/u/amauryguthmann)\
**Post date:** [December 20, 2020, 10:33pm UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373/5 "2020-12-20T22:33:33Z")

</div>

Thanks for your answers.

I went the shorter for writing this 1st message “Need of help” and did not gave the entire context on the use case.

I want to test if the field user-account-id is empty or not as a constraint of the user’s log in :  
 → if yes : the user is not logged in and then an alert appears on the login form  
 → if no : then the use is logged in.

Then I firstly tried to do that with the following Only When :

 ![Capture d’écran condition 1](https://us1.discourse-cdn.com/bubble/original/3X/a/c/ac7633b63a43f330cf04c9745a7488d33003f9f8.png)

It did not work.

Then I just simply tested a count on the Users Search request’s which return 0 and then wrote the 1st message 🙂

When I have a look on the debugger, it appears that the request does not return any user corresponding to the email address put in constraint even if the email address is within the DB.

 ![Capture d’écran count](https://us1.discourse-cdn.com/bubble/original/3X/7/5/75051c1f84581c8ae14fa57888ba76ec6eb298ca.png)

Once logged in, I tested the following request count which again unexpectedly return me 0

 ![Capture count email](https://us1.discourse-cdn.com/bubble/original/3X/3/4/34bf524f8739a8cb578eeafb742e04284e2a538f.png)

When I tested the following, it returns me 1, as expected.

 ![Capture condition unique Id](https://us1.discourse-cdn.com/bubble/original/3X/b/f/bf48084e8c806fd89a54402c929e4d2b17064d4d.png)

Is there any topic with request containing a constraint on the user’s email ?

Thanks and best regards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [February 26, 2021, 7:53am UTC](https://forum.bubble.io/t/only-when-condition-in-action/126373/6 "2021-02-26T07:53:56Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
