Formatting Nested IF Statements

I would love to have some kind of visual indicator of which IF Statements are tied together when there are multiple statements nested. Perhaps its a color change that happens automatically much like the parenthesis do within Excel formulas to show which open and close parenthesis are related. This would make it much easier to quickly create and manage nested IF Statements. Here is an example of multiple nested IF Statements that I currently use, yet I find it challenging to quickly make edits.

{note: preview=no}
{if: date3 >= today AND today >= date1; trim=right}
{if: date1 >= today AND contains(programname, "Campus"); trim=right}
Within 2 weeks after starting date
{elseif: date2 >= today; trim=right}
Within 1 month after starting date
{elseif: date3 >= today; trim=right}
Within 2 months after starting date
{endif: trim=right}
{else: trim=right}
{import: |9}
{if: date3 >= today AND today <= date1; trim=right}
Outside Bracket

If you support this idea, make sure to click the Vote button at the top!

Thank you for considering this idea!
-Brad :fire:

@Brad_Hedinger - maybe this helps. If you hover over any of the if/elseif/endif commands, the corresponding parts of that command will change color to show you that they're related.

For instance, try hovering your mouse pointer over the command right underneat the text that says, "Within 2 weeks after starting date"

1 Like

Thank you @Cedric_Debono_Blaze! I actually never noticed that before - perhaps due to how I have my monitor displays calibrated. The shading is very slight. I think the real value in this kind of functionality would be to show the relationships in static form; showing the color change as you write and/or view the snippets.

1 Like

Got it. Thanks for clarifying. :slight_smile:

1 Like

Sure thing! I have noticed that shading before, but I see it whenever I hover over any element...not just related elements. I just thought that was an indicator that I was hovering over something, much like when you mouse over a button on a webpage and it slightly changes color.

It works for all commands that have multiple parts, such as note, formtoggle etc

1 Like

Brilliant tool, and exceptionally great support.
Cedric we could sing you praises for days. Thank you.

After spending ages lost in nested IFs that would not work AND colors were not helpful at all
May I suggest some sort of indent for nested IFs. They are used in most languages and would be super helpful to all users.
Thank you all again for your fantastic work and being super supportive. You are great partners!

1 Like

Hi @Zita_Daniel_Nad

Thank you for your kind words.

With regards to nested {if} command blocks, try hovering over an {if} command and you should notice that the corresponding {elseif} and {endif} commands for that block turn slightly darker, to show you that they belong to that block.

That said, our engineering team will take your feedback into consideration. Maybe we can identify a better way to highlight such command blocks.

I spotted you suggesting the hover method to someone. It is great when the IF statement is correctly closed, but if it is not the hover method does not work.
Now imagine ifs going 4 or 5 layers deep, let's also imagine that all variables have accidentally been named the same and you have no way to tell which one is where...

Actually, another suggestion for improvement would be to prevent naming variables something that another variable in the same snippet is or in a snippet being imported. If this is not possible perhaps just have a warning message to remind users that variables should be unique.

Again, thank you all so much for the hard work you do developing this great tool!