Laserfiche Forms Month Formatting
A field may be required to display the month in a special format other than the typical date values provided by Laserfiche Forms. We will take advantage of the Function feature in Laserfiche Forms to format the month into a value that is not normally displayed. Four formatting methods will be used in this example:
Zero Padded Numeric Month
Abbreviated Month Name
Full Month Name
A sample of the example can be downloaded here.
This example will be performed in the Laserfiche Forms Layout Designer and will require a creation of fields.
The first field that must be created is a Date field. The formatting will not be executed correctly unless a date value is evaluated. Add a Date field in the canvas with the label of “Date” and the variable name of “DateField”.
Numeric Month Value with No Padding
The MONTH function returns the numeric value of a month when evaluating a date. For example, a date of February 19, 2020 will return the value of 2.
Add a Single Line text field to the canvas with a label name of “Month (M)” and variable name of “Formatted Month No Padding”.
Then select the Advanced tab of the field and use the following function:
The “DateField” in the parenthesis would be the variable name of the date field created in the first section.
The result of this function will be the numeric value of the Month when a date is selected in the Date field.
Numeric Month Value Zero Padded
The Month function returns a non-padded numeric value. There may be use cases where a zero padded numeric month value is needed. Adding a zero in front of a single digit month will require the introduction of the CONCATENATE and RIGHT functions. The CONCATENATE function combines values together in the sequence they are defined in the function. The RIGHT function returns a set of characters from the right based on the number specified in the function.