Category:Map Files
Last Updated:2012-01-27
 
As of version 3.3 the string manipulation routines have been enhanced.
String manipulation is used within custom map files. Map files dictate the movement and format of attributes from the source to destination directory. If you have a unique format for an attribute we suggest you create a custom map file and use the examples below as a guide to producing desired results.
The basic syntax for string extraction is:
[dest attribute]#[Num of characters],[Offset]=^some source attrib^
| [Num of characters] | refers to how many characters you would like to extract from the string. |
| [Offset] | refers to where in the string to begin pulling from. Zero or no value means to start at the left most character. A positive value means so many characters from the left. A negative value means so many characters from the right. |
Num Of characters may be specified alone. When using Offset, Num of Characters is required.
Examples:
In this case we will manipulate the title attribute. The source value for this attribute is:
president
Pull 4 characters from the left
title#4=^title^
or
title#4,0=^title^
result: pres
Pull 4 characters from the right
title#4,-4=^title^
result: dent
Pull the 5th character
title#1,4=^title^
result: i
Pull the last character
title#1,-1=^title^
result: t
Remove last 5 characters
title#-5,0=^title^
result: pres
The same logic may be used on the ^SourceAttribute^ portion of the mapping for a similar result:
i.e. Using the first example from above: extension-attribute-1=^sn#4,0^
Further, attributes may be "built" from multiple source fields or with a combination of fixed values. For example, take the first letter of given name, period, full last name, dash, last 4 digits of phone number would look like:
extension-attribute-1024#=^givenname#1^.^sn^-^telephonenumber#4,-4^
result: E.Richardson-7890
Another way to pull trailing digits is to use substr sub routine:
extension-attribute-1024#=^givenname#1^.^sn^ - &substr("^telephonenumber^",-4,4)&