Feature Request - Comments inside Application Formula/Expression

Dear Product Developers,

I would like to request a simple feature to allow commenting inside Application Formula/Expression please?

For example, in basic language you can use an apostrophe ’ or in C language you can use the / Comment / combination.

I have some complex formulas and expressions in which I sometimes forget why it does certain things, so being able to comment it line by line would be very useful.

Thanks,

Colin.

Like the 14th time this has been requested. :nerd_face:

3 Likes

Indeed.

1 Like

Clearly I (we) need to spend more than just being a customer of a single Pro licence…

Maybe they worry if we get this, we might expect color coding, automatic indentation and parenthesis checking too? I am sure evaluation beginners would like that as much as the veterans?

If we are really spoiled we might even want reusable expressions and other reusable/sharable items??? I mean, you know, I might have some reusable things that you might like to easily use or vice-versa?

There is an extension for reusable expressions and better indentation and automatic open and closing of ,(),"",’’, etc.I don’t remember the link to it but I guarantee someone here knows what I’m talking about.

Found it!

While at should also make the expression assistant variable width for longer expressions.

2 Likes

Just as an FYI, there ARE ways you can include comments in your formulas; it’s just a hack of a way to accomplish it. :nerd_face:


If you’re building a series of cascading IF() statements (or if you’re using the IFS() version), you can include a condition that will never be true and include you comments there.


In the image above, you can see I’ve included a line that contains an IF() statement that will NEVER be true; this then contains my comment that reminds me what part of the algorithm I’m in.

if(true=false, “//My comment here”, “”)

Because TRUE will never be equal to FALSE, this part of the series of IF() statements is skipped.


The same can be accomplished inside a concatenate as well; for instance, the following formula:

Concatenate(
“Something”,
if(1=2, “//my comments here will never be included”, “”),
" and the other thing."
)

…gives the following output: “Something and the other thing.”

The comment in the middle is excluded; technically it IS included, but it’s an empty space that’s added in. If I were to show this with a line, the technical output would be:

“Something| and the other thing.”

With the line ( | ) representing the empty space that was added in; but since it’s empty you don’t see it. :nerd_face:


For numbers, decimals, etc. - you have to wrap the comment in a type forcing function in order for the formula to evaluate:

if(1=2, decimal("//For example, this formula is to calculate a price, so the text needs to be a decimal"),
[Hours] * [Employee_Ref].[Employee_Per_Hour]
)

if(true=false, DateTime("//This example would be for a dateTime"),
[Record_DateTime_Column]
)

if(“X”=“Y”, NUMBER("//This would be for a number column"),
HOUR([CreationDateTime])
)


In AppSheet you’ll find there’s…

4 Likes

Appsheet is definitely the king of finding another way lol.

1 Like