# List and file mapping

You can apply a mapping to text list elements in two functions:

- The [`TextListMapping`](<https://help.apteco.com/en/faststats/expressions/list-functions/index.md#textlistmapping>) function allows you to take the elements of a text list and apply your selected mapping.
- The [`TextListFromFile`](<https://help.apteco.com/en/faststats/expressions/file-functions/index.md#textlistfromfile>) function also allows you to include optional mapping when reading a text list from a column in a file.

## Available options

The available mapping options are described below. The example results show each space as an underscore (`_`).

### RJZP

Right Justified Zero Padded

Must be used with the mapping size parameter.

This mapping creates a string of the mapping size with '0' characters at the start.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList("Hello", "World"), "RJZP",8))
```

This expression returns `000Hello,000World`

### RJBP

Right Justified Blank Padded

Must be used with the mapping size parameter.

This mapping creates a string of the mapping size with ' ' characters at the start.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList("Hello", "World"), "RJBP",8))
```

This expression returns `___Hello,___World`

### PostDist5

This mapping creates a string with the postcode turned into a 5 character postal district.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList("CV34 4HD", "M20 2DF", "SW1A 4WW", "B1 1DF"), "PostDist5"))
```

This expression returns `CV34_,M_20_,SW_1A,B__1_`

### PostDist4

This mapping creates a string with the postcode turned into a 4 character postal district.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList("CV34 4HD", "M20 2DF", "SW1A 4WW", "B1 1DF"), "PostDist4"))
```

This expression returns `CV34,M_20,SW1A,B__1`

### PostDistToPostDist5

This mapping creates a string with the postal district turned into a 5 character postal district.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("CV34", "M20", "SW1A", "B1"), "PostDistToPostDist5"))
```

This expression returns `CV34_,M_20_,SW_1A,B__1_`

### PostDistToPostDist4

This mapping creates a string with the postal district turned into a 4 character postal district.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("CV34", "M20", "SW 1A", "B1"), "PostDistToPostDist4"))
```

This expression returns `CV34,M_20,SW1A,B__1`

### Upper

This mapping creates a string with all lower case characters turned into upper case ones.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("Hello", "World"), "Upper"))
```

This expression returns `HELLO,WORLD`

### Lower

This mapping creates a string with all upper case characters turned into lower case ones.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("Hello", "World"), "Lower"))
```

This expression returns `hello,world`

### PostArea

This mapping creates a string with the postcode turned into a postal area.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("CV34 4HD", "M20 2DF", "SW1A 4WW", "B1 1DF"), "PostArea"))
```

This expression returns `CV,M_,SW,B_`

### PostSect

This mapping creates a string with the postcode turned into a postal sector.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("CV34 4HD", "M20 2DF", "SW1A 4WW", "B1 1DF"), "PostSect"))
```

This expression returns `CV34_4,M_20_2,SW_1A4,B__1_1`

### UpperNoSpaces

This mapping creates a string with all lower case characters turned into upper case ones, and then removes spaces.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("Hel lo", "wor ld"), "UpperNoSpaces"))
```

This expression returns `HELLO,WORLD`

### Proper

This mapping creates a string with all words proper cased.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("HELLO", "world"), "Proper"))
```

This expression returns `Hello,World`

### TPSNoSpaces

This mapping creates a string where all telephone numbers are TPS formatted and spaces removed.

Example:

Expression

```apteco
StrList(TextListMapping(CreateTextList ("01224-631892", "+441234567890"), "TPSNoSpaces"))
```

This expression returns `01224631892,01234567890`

## Related topics

For more about the functions that use these mappings, see:

- [List functions](<https://help.apteco.com/en/faststats/expressions/list-functions/index.md>)
- [File functions](<https://help.apteco.com/en/faststats/expressions/file-functions/index.md>)
