Feature Request - Comments inside Application Formula/Expression

aucforum
Participant V

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.

Status Open
87 27 3,308
27 Comments
MultiTech
Participant V

Like the 14th time this has been requested.

Koichi_Tsuji
Participant V

Indeed.

aucforum
Participant V

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?

Austin
Participant V

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.

MultiTech
Participant V

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.


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.


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…

Austin
Participant V

Appsheet is definitely the king of finding another way lol.

pravse
Staff

@natalie FYI

aucforum
Participant V

It is a sign!

It is a sign from the Messiah!

pravse
Staff

now, now :]

Actually, a bunch of you appropriately complained that we had not responded to these feature requests. So I’m working my way thru them this weekend and annotating those we are already working on and those we are definitely not, and for the rest, putting them into the appropriate buckets. For example, I know @natalie has explored this, so will find out where this stands and then respond.

nkadonaga
Staff

Supporting inline comments would be tricky for us. Adding support for it is unlikely to be 100% backward compatible with existing apps, and once we introduce it, it will be difficult to make changes to it, should we find that our initial solution was flawed. I believe a feasible solution exists, but it requires some additional resources to execute it carefully that I’m not sure we have at the moment.

Steve
Participant V

I vote for writing a new expression interpreter from scratch.

nkadonaga
Staff

Haha, no problem Steve… just give me a few years

WillowMobileSys
Participant V

If performance is a concern, I would not recommend using this workaround. If you use them, do so VERY sparingly.

In actual programmatic source code, comments are stripped out at compile time so the actual runnable code of the app never has the comment lines in it.

The technique above is an actual line of code, that will find its way into your compiled (runnable) app. The app will need to physically inspect it (which takes time) to decide nothing needs to be done each time the expression is executed and for each line in the expression implemented in this way.

One or two of these here and there won’t make a difference. But it is easy for them to add up over long periods of development time.

aucforum
Participant V

I am beginning to think Appsheet needs to be a new product as version 2.0 with a facility to upgrade older apps.

Status changed to: Open
Pratyusha
Community Manager
Community Manager