![]() |
Next Page |
| Contents > Creating a database > 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 C style or C++ style comments, which you can enter anywhere in a formula. |
| C++ style comments begin with the characters // and finish at the end of the line. |
| To add comments to a formula: |
| 1. | With the database open, choose File menu > Manage > Database. |
| 2. | In the Manage Database dialog box, click the Fields tab. |
| 3. | If your database contains more than one table, select the appropriate table from the Table list. |
| 4. | In the Fields tab of the Manage Database dialog box, select the calculation field, then click Options. |
| 5. | In the Specify Calculation dialog box, enter your comments. |
|
|
See Defining calculation fields for information about the dialog box. |
| 6. | Click OK. |
| C style Example |
| Everything shown below can be entered inside a formula: |
| /* This is a calculation with C style nested and multi-line 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 */ |
| ) |
| C++ style Example |
| 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 |
|
|
| Contents > Creating a database > Working with formulas and functions > Adding comments to a formula | Next Page |