eADM

[SUBSTRING] - Extracting Parts of a String

The [SUBSTRING] function allows you to extract a portion of a text string from an attribute. This is useful for cleaning up data, for instance, by removing a department number that has been included as a prefix in a department's name.



Syntax

The Syntax is:

[SUBSTRING;StartIndex;NumberOfCharacters;Attribute]

  • StartIndex: The 0-based index from which to start the extraction. For example, an index of 3 will start the extraction at the fourth character of the string.

  • NumberOfCharacters: The maximum number of characters to return.

  • Attribute: The attribute containing the string you want to extract from (e.g., [Department]).



Use Case - Removing a Prefix from a Department Name

In some systems, department names are prefixed with numbers, such as "37 Kullungen barnehage". This can make lists and directories, like those on a public website, appear untidy.

Use the [SUBSTRING] function in an export template to remove the prefix from the department name before it is displayed or sent to another system.


  • Input [Department]: 37 Kullungen barnehage

  • Expression:

    [SUBSTRING;3;99;[Department]]
    
  • How it Works: The expression starts extracting from index 3 (the fourth character), which skips the first three characters (3, 7, and the space). It then returns the next 99 characters, which is a number large enough to capture the rest of the string.

  • Output: Kullungen barnehage