Format String Expressions

Cory Fifield -

Trouble viewing images? Click on images to enlarge.

 

In this article we cover using format strings inside the Finished Reports expression editor. 

 

Important Note:

It is very important to note that this method should not / does not replace replace using the format strings set on the label. When a format string is applied at the expression level, this will change the actual value of the data vs masking how it is displayed.

 

For example. if there was a date value of 1/1/2021 12:00 PM and a format string is used at on the label to make it appear as January 1, 2021, the value would still be 1/1/2021 12:00 PM.

 

When the format string is applied at the expression level, the actual value of the data is being changed. This means the date value of 1/1/2021 12:00 PM is now actually February 1, 2021.

 

Example Format Strings

FormatString('{0:MMMM dd, yyyy}',Today()): February 18, 2021

FormatString('{0:yyyy-MM-dd}',Today()): 2021-02-18

FormatString('{0:(000) 000 - 0000}', ToLong([Phone Number])): (219) 689 - 6964

 

How To Use Format Strings In The Expression Editor

1. Open/Create your View and run it. Then go into the Finished Reports Designer.

mceclip0.png

 

2. Place a label into the Finished Report and go into the expression editor.

mceclip1.png

 

3. Create your expression and add the format string 

mceclip3.png

 

4. Preview the results. The top label uses the format string on the Today() function. The label below is the same function, without the format string.

 

Results: 

Format String: February 18, 2021

No Format String: 02/18/2021 00:00:00

 

mceclip0.png

Have more questions? Submit a request

Comments