Reputation: 173
Is there a way to execute expressions based on multiple conditions:
e.g.
If Condition1(a boolean param) is true AND condition2(boolean derived from param) is also true, then execute expression A. Similarly, condition1 false AND condition2 false -> expression D
I'm aware of the "union" where where not technique, but I think I'd need to nest the union structure inside another such union:
but I couldn't get this syntax^ to work.
Any suggestion is appreciated(even if not directly about achieving nested conditional execution) TIA!
Upvotes: 1
Views: 980
Reputation: 173
Nvm, figured it out(fixed syntax errors). here's a working solution for this. Maybe it'll help someone:
let cond1 = false;
let cond2 = true;
let A = print "A";
let B = print "B";
let C = print "C";
let D = print "D";
let AC = union (A | where cond2), (C | where not (cond2));
let BD = union (B | where cond2), (D | where not (cond2));
union (AC | where cond1), (BD | where not(cond1))
Upvotes: 1