Contains (PQL)

Checks if a supplied string contains the sub-string.

  • Returned Output: Boolean
  • Library: PQL \ Granular \ String
  • Version: 2023.00.000
  • Compatibility: Pyramid Query Language (PQL) data sources

Syntax

Contains( <Column String> , <Search Text> )

* Click on the function's arguments above for more details on the input values.

Comments
  • The column needs to be an attribute with string / text values in the model. (The data type needs to be 'string')
  • The search text should be a string in double quotes.
  • For details on how to employ and use this function see the custom column overview.
Different Function types
  • This function is similar to the PQL semantic and common functions of the same name. However, it operates on a column directly at the grain.
  • As a granular function, it is used in the base SQL query itself.

Examples

In this example, the Contains function is used to check if the current user's roles contains a certain value ("CEO"), triggering a different column treatment if it does.

If( Contains( UserRoles(), "CEO"), "[OrgChart].[Management]", "[OrgChart].[Cost Centers]" )

 

This example returns a true/false column if the firstname column contains the string "a".

Contains([customers].[FirstName],"A")

You can see the effect from this example snippet in column #6 below, based on the source column in positions #1.