Select localized values for a property and autofill unused property positions

The locale function is used to select localized values from the source object. The locale function is case-sensitive, and all letters are lower-case. The third parameter, 'autofill', is optional. This parameter is used to automatically populate the unused locale positions with the default locale value returned in position 1.

Note: The 'autofill' parameter is case-insensitive but must be a literal, enclosed with single quotes.

Syntax

SELECT locale(localizedproperty, number of positions, 'autofill') FROM object

Example

In this example, the Data Catalog has only three locale selections: 1 for en_US, 2 for fr_FR, and 3 for es_ES. If five positions are selected, these values are returned:

  • greeting_1 for English
  • greeting_2 for Spanish •
  • greeting_3 for French greeting_4 and greeting_5 return the default value in position 1 for English because the value is not defined.
SELECT Id, locale(greeting,5, 'autofill') from common_greetings

This table shows an example:

Id greeting_1 greeting_2 greeting_3 greeting_4 greeting_5

1

hello

hola

bonjour

hello

hello