Skip to main content
All CollectionsHelp ArticlesApricot Native ReportingAdvanced Reporting
What are common custom expressions used in reports? (Native Reporting)
What are common custom expressions used in reports? (Native Reporting)
Updated this week

Custom Expressions can be used to change how data within a column is displayed in a report section. While there are already different data styles and formatting available within different column types that affect this, custom expressions allow for even further customization when utilizing the proper syntax.

Certain custom expressions need to be entered in a specific column's properties to function properly. For example, creating a link to a participant's Document Folder within a native report requires that the custom expression is set up in the Tier 1 Participant form's Record ID field or column in a report section. Other custom text or custom numeric expressions can be modified within any column's properties by clicking the green gear icon next to it.

Continue reading below to learn common ways to use custom text and numeric expressions in the Report Builder.

Note: If there are problems with your syntax in a custom expression, Apricot will display an error indicating which column, section, and line the error occurs within along with a hint on how to resolve it. The error message will show you only the first error that it finds, so if there are multiple errors you will need to resolve them one at a time until the pop-up no longer occurs. ​If you close out of this pop-up and need to view it again, you can click the button on the right-hand side of the report to review these details.

Display the last run date and time

Use this custom text expression in any column to show in a report what time it was last run or when the data was last refreshed:

  • Date_format(Now(),'%m/%d/%Y %r') 

Display how long since created or last modified

Use this in either a Creation Date or Modification Date field to display the hours, minutes, and seconds since the record was created or modified.

  • TimeDiff(Now(),[column]) 

Show early, on time, and late data entries

Convert a Creation Date field to time and display whether a data entry was created "Early", "On Time", or "Late".

  • IF(ADDTIME(TIME([column]), "1:00:00") < "12:29:59" , "Early", IF(ADDTIME(TIME([column]), "1:00:00") BETWEEN ("12:30:00") and ("12:30:59"), "On Time", "Late"))

Pull first or last initial

The expression below will pull the first character from the column to the left. You can then include this in a Text Calculation column to show only a participant's initial in a report.

  • Left([column],1) 

Display column characters

If you need to know the number of characters being pulled into a column, you can use the expression below.

  • Length([column]) 

Clicking into the report cells already directs you to the record, but if you’d like to provide a link to the document folder in your report, use this expression in the Tier 1 Participant form's Record ID column.

Add conditional formatting to columns

The expression below is an example of how conditional formatting with hex color codes can be used in Apricot reports.

  • IF([column]='Unexcused',CONCAT('<b><font color="#FF0000">',[column],'</font></b>'), IF([column]='Attended',CONCAT('<font color="#009933">',[column],'</font>'), IF([column]='Partial Attendance',CONCAT('<font color="#FF9900">',[column],'</font>'),[column])))

Format phone numbers

Apricot formats phone numbers with "." symbols instead of "-" symbols by default. You can use this if you prefer to see 555-555-5555 instead of 555.555.5555, but it will also cut off the three extension digits for these values.

  • LEFT(replace([column], '.','-'), 12)

What else do you need help with?

Did this answer your question?