Replace (PQL)

Returns replaces instances of the search string found inside a provided string with a replacement string.

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

Syntax

* 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 and replace text should be strings in double quotes.
  • The function replaces ALL instances in the target column.
  • 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

This example returns a column of text where all "a" characters in the firstname column have been switched to "*" characters.

Replace([customers].[FirstName],"A","*")

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