Custom Mapping: String Manipulation2019-08-15 16:41:05
Custom Mapping UnitySync
String manipulation is used within custom map files to truncate or extract characters from a string. 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. Of course, you are always welcome to contact our Technical Support Team for assistance.
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, and may be specified alone.
[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. When using
[Num of Characters] is required.
In this case we will manipulate the title attribute. The source value for this attribute is president.
Pull 4 characters from the left
Pull 4 characters from the right
Pull the 5th character
Pull the last character
Remove last 5 characters
The above examples will work on all versions of UnitySync.
If you want to build a value from multiple source attribute values, however, you may use scripting in combination with string manipulation. A mapped value may be constructed from multiple source fields or with a combination of fixed values. For example, if you want the first letter of given name, period, full last name, dash, last 4 digits of phone number…
In this example, we will concatenate and trim data. Our Source data includes:
If we map:
The Synced values will be:
In this example, we will reformat the date. Our Source data is:
And we map:
The Synced value will be: