FYI: how to use AND / OR clauses in IF-Statements

In case someone else bumps into this:

The syntax of the IF-statements is very natural in Causal.

However, I’ve been struggling with AND & OR operators a bit.

Secret sauce: brackets.

IF a > b AND c = d THEN 1 ELSE 0

is having trouble while

IF (a > b) AND (c = d) THEN 1 ELSE 0

works like a charm :slight_smile:

1 Like

Hey Fabian,

That doesn’t seem true, in the following model (and/or query - Causal), “New Variable” has the same formula as the one mentioned by you in your post without the brackets, could you elaborate a little more on what exactly do you mean by “having trouble”, maybe we can help you out better.

Both of those syntaxes should work within Causal - no brackets or parentheses needed!

I was trying to use AND/OR clauses recently, couldn’t figure it out. There are no examples in the documentation, so I assumed causal couldn’t do this.

Would be good to show how easy this is, using Causal!

Hey Jason, thanks for the feedback! I just updated our documentation - you can now find some examples in our formulas article. Please let us know if you keep having issues!

Hey @lorenz_causal that’s fantastic, thanks!