Articles in this section
Category / Section

How to write Expressions for different types of Databases in Bold BI?

Published:

When working with different databases the expressions supported in it will differ too. It is important to be aware of the specific functions and syntax for each database. For instance, we have two different expressions for calculating ‘age’, one for PostgreSQL and one for SQL Server.

PostgreSQL Expression

For PostgreSQL, you can use the age() function to calculate the difference between two dates. The correct expression for this data source is:

EXTRACT(YEAR FROM age(cast([PatDob] as date)))

SQL Server Expression

For SQL Server, the age() function is not available. Instead, you can use the DATEDIFF() function to calculate the difference between two dates. The correct expression for this data source is:

DATEDIFF(year, [PatDob], TODAY())

When working with different live databases, always ensure that you are using the appropriate functions and syntax for each database to avoid errors.

For extract mode data sources, the expression should be compatible to the database configured in the Bold BI data store settings.

Related Links

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
RM
Written by Reethika Moovendhan
Updated:
Comments (0)
Please  to leave a comment
Access denied
Access denied