Creating a custom app > Working with formulas and functions > Adding comments to a formula
 

Adding comments to a formula

For complex or infrequently used formulas, you can add comments to explain the details. Use block comments or end-of-line comments, which you can enter anywhere in a formula.

Block comments start with the characters /* and finish with the first occurrence of the characters */. Your explanatory text appears between the two asterisk characters. Comments can begin on one line and end several lines later. You can nest block comments.

End-of-line comments begin with the characters // and finish at the end of the line.

To add comments to a formula:

1. In the Specify Calculation dialog box, enter your comments.

See Defining calculation fields for information about the dialog box.

2. Click OK.

Example of block comment

Everything shown below can be entered inside a formula:

/* This is a calculation with block comments nested and multiline comments/*----- It returns the title if it exists in a name -----*/*/Case(PatternCount("MrMsMrs", LeftWords(Name, 1)), /* returns true if the first word in fieldName matches anyone of the titles Mr, Ms or Mrs*/LeftWords(Name, 1) /*extracts the title */)

Example of end-of-line comment

Greeting & "!!" // returns Hello!! if field Greeting contains the string "Hello"

Related topics 

About formulas

About functions

Functions reference (category list)

Functions reference (alphabetical list)

Text operators

Using operators in formulas