Examples: Creating a formula for an editable field
Default value formula examples
The default value formula provides an initial value for an editable field. You can set the value to a specific number or text string, or you can use a formula. For example:
The formula |
Returns |
---|---|
0 |
The number 0 |
@Now |
The current time and date |
@Name([CN];@Username) |
The common name portion of a user's hierarchical name |
Price |
The value of the field named Price |
"Connecticut":"New York":"New Jersey" |
A text list containing Connecticut, New York, New Jersey |
Product + ", " + Department |
The value of the field named Product, followed by a comma and a space, and the value of the field named Department |
Example: Input translation formula
The following formula translates the text in the Attorney field for display with initial capital letters. If a user enters the text john smith in the Attorney field, it is translated to John Smith when the document is saved.
@ProperCase(Attorney);
The following formula gives documents a uniform look by capitalizing the initial letter of the value in the Subject field and removing extra spaces.
@Trim(@ProperCase(Subject));
Input validation formula examples
Field criteria |
Formula |
---|---|
User must enter a value that is less than 100 in Cost field |
@If(Cost<100;@Success;@Failure("Cost must be less than $100.")); |
User must enter a value for the Subject field |
@If(Subject = ""; @Failure("You must enter a subject for your document."); @Success) |