'Switch' formula for Bases

Use case or problem

A formula equivalent to the ‘Switch’ formula in Excel or Google Sheets to avoid messy nested ‘if’ formulas.

Proposed solution

Syntax something like?

switch([case1],[value1],[case2],[value2]...etc)

Current workaround (optional)

Nested if statements. More difficult to read/write.

Thanks Obsidian wizards!

You can create the equivalent of that switch function using filter():

[[case1,value1],[case2,value2],[case3,value3],[true,fallbackValue]]
.filter(value[0].isTruthy())[0][1]
1 Like

Thanks. That worked. Nice to still have the feature for a non-dev Obisidan user like me but perhaps I’m in a minority!