Forum Academy Marketplace Showcase Pricing Features

[Resolved ]AND / OR Conditional Statement

I am creating an app (which is purely for fun). The aim is to take user’s Month and Date of birth and then show general career characteristics. ignore the science for a bit :smiley:

Anyways, the issue I have is, all Zodiac signs have Months which overlap (dates are unique). So I am creating a hidden group and only make it visible when the criteria for particular zodiac matches.

As an example visit

In this, For the month - the conditional statement is If Month is “April” AND Date >= 20 OR Month is “May” AND Date =< 20 then make the Taurus text visible.

When i run it in preview mode here

If I select May, it shows the hidden element straight away without waiting for the date (And May 21 onwards, the zodiac sign is different to Taurus, so it has to wait till date is confirmed). Whilst if I select April, it waits for the date. This is probably due to the OR condition in my logic, however I can’t think of resolving this in any other way.

Any help, please?

I’ve created a new page on your program with a way that works. Here’s a link…
Test Page

The main thing you have done wrong is, you’ve made a formula which has a format like the following…

(If Month is “April” AND Date >= 20) (OR Month is “May” AND Date =< 20) then make the Taurus text visible.

Notice how I put the brackets? Bubble can’t use bracketed formulas like this. You’ve done the same thing except without the brackets.

You needed to separate each section of the formula like this…

If Month is “April” AND Date >= 20 then make the Taurus text visible.
Then press the ‘Define another condition’ button. (circled in yellow in the image below)
if Month is “May” AND Date =< 20 then make the Taurus text visible.

It should look like this box in the end.

1 Like

Thanks for the effort @cakeheke . Your logic explanation is correct. I was looking for the brackets but bubble doesn’t use that for conditional logic.

However, the problem is still there (even if you look at the test page you created).

The problem is, in the Month as soon as I select May… the logic kicks in and doesn’t wait for the Day input. Even when the condition is split in two boxes (I tried that again and again, but it doesn’t work)

Did you get that to work? Can I see a simple example of that, please?

I’ll have a look and get back to you.

I got it…

  • The ‘Taurus’ text element still had the conditioning statements for the same dates as the ‘Aries’ text element.
  • I removed the conditions from the ‘Taurus’ text element and it works correctly.
  • You need to set up the ‘Taurus’ text element with different dates than the dates on the ‘Aires’ text element.

Here’s an updated view of the corrected conditional statement for anyone else who might be trying to work out something similar in the future…


Would it not be easier to set up a thing with data ranges and descriptions and do a search ?

Both ways have their advantages.
I expect the way Faiz was doing it would make for quicker computation and hence a faster program.
However - setting it up from the database or custom-state, would give more options but would also cause the database to be less clean.
Over the whole course of his program - it would create another 24 entries in the database, or 24 custom states to set up.

I would personally use custom-states, but it’s good to show Faiz where he went wrong so he can learn what to look out for.

Thanks a ton @cakeheke . It took me a while to see the > 0 logic at the end of the condition. And now it makes sense.

  • NigelG - you are probably right. It’s just that this is a fun app (don’t see it being there for life :slight_smile: ) and hence didn’t go for the “right thing” - just went for the “quick one”!