Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Adding Comments to Expressions

TaraM
Alteryx
Alteryx
Created

Question

Is it possible to add a comment to an expression used in a Filter or Formula?

Answer

Yes, once you have a valid expression, just use // followed by your comment on the next line.
comment.PNG

Comments
MarqueeCrew
20 - Arcturus
20 - Arcturus

/* you can also

add blocks of comments

into the formula */

 

i use use this technique when I comment out old code in place of new code. 

 

 

marlline
8 - Asteroid

That is very useful. Thank you!

papalow
8 - Asteroid

Thanks for posting this.  I will be using this in documenting and testing workflows.

thomas_vdb
7 - Meteor

You don't need to go to the next line.

 

You thus have 2 ways:

- comment in line with // : anything after this on this line is commented

      you can use it to place in comment a full line or comment at the end of a line

 

- comment by block with /* your comment */ : anything in between this is commented, whether it's on the same line or not.

     you can use it to comment several lines at a time, or just a portion of a line (in that case, be careful about content in quotes, plus it's not very readable)

 

Illustration

Capture3.PNG

RichP
6 - Meteoroid

//Thank you

akshaycr
5 - Atom

You could also do that by using 'Show Annotation' option in the Tool's 'Annotation' configuration.     

R643543
5 - Atom

thank you!!!

vasumurugan5459
7 - Meteor

Thanks!!

grace_xie
5 - Atom

Thanks!!

NBruinsma
5 - Atom

I recently learned a little trick:

If you add in a couple of slashes, then you can make it so that a single character can be used to toggle between commenting code out or including it.

 

 

//*

you can also

add blocks of comments

into the formula //*/

 

When the first slash is removed, the /* takes effect, which makes the last red slashes into part of the block comment. When it is added in, it comments out the initial * which indicates the start of the comment and the bottom // comment out the end block comment */

 

I thought it was a clever trick.

k3pineapple
8 - Asteroid

Thank you for the posting and answer , try to add this for a while