# Two AND, one OR statements: how to combine?

Hi,

I would like to show an element in the following four periods every hour:
hh:05 till hh:09
hh:35 till hh:39
hh:25 till hh:29
hh:55 till hh:59

The first two can be covered with this formula:
\$abs(#Dm#-22)>=13&&abs(#Dm#-22)<18? 100 : 20\$
The second two with this formula:
\$abs(#Dm#-42)>=13&&abs(#Dm#-42)<18? 100 : 20\$

Now I would like to combine these statements for the single element as follows:
First formula OR second formula

I thought of solving it this way:
\$abs(#Dm#-22)>=13&&abs(#Dm#-22)<18||abs(#Dm#-42)>=13&&abs(#Dm#-42)<18? 100 : 20\$

This does not work though. Can anybody tell me where my mistake is and put me on the right track?

Thanx!

Pierre

bummer @pierre no that won’t work. You cannot chain conditionals beyond 2 conditions. You can say:
If this AND that, then… or If this OR that, then… But you cannot execute any deeper logical combinations.

You can NEST conditionals but only on EQUALS.
If this=A then X, elseif that=B then Y, else if ThatOtherThing=C then Z, otherwise NOTHING.

However, (and I don’t know your scenario) you can repeat an appearance in a cycle. You stated a showing at 5, 25, 35, and 55 seconds. Let’s ignore the absence at 15 and 45 for a moment and say instead that you want your object to appear every 10 seconds on the 5’s for 4 seconds each…
hh:05 till hh:09
hh:15 till hh:19
hh:25 till hh:29
hh:35 till hh:39
hh:45 till hh:49
hh:55 till hh:59

If you can live with that case then consider FLOOR()ing one-tenth of a second x 10. That would count 0-to-9 every ten seconds: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 and so on. Now, you can pick out the 5-to-9 periods each 10 seconds in the minute 6 times:

\$(#Ds#-(10*(floor(#Ds#/10))))>=5&&(#Ds#-(10*(floor(#Ds#/10))))<10?100:0\$

Now if you somehow “hide” the 15 and 45 period (or put something over it?) I think you’d have what you’re looking for (maybe?).

-john

hh:05 till hh:09
hh:35 till hh:39
hh:25 till hh:29
hh:55 till hh:59

mod: \$x-floor(x/y)*y\$

Simplest logical expression:

\$(#Dm#>=5&&<=9)||(#Dm#>=35&&<=39)||(#Dm#>=25&&<=29)||(#Dm#>=55&&<=59)?100:20\$

Or, mathematically as was suggested above: (instead)

\$(#Dm#-floor(#Dm#/10)*10)>=5&&(#Dm#-floor(#Dm#/10)*10)<=9&&floor(#Dm#/10)!=1&&floor(#Dm#/10)!=4?100:20\$