Product: Mapping Manager
Article Link: http://help.truecommerce.com/en/articles/6666635-mapping-manager-function-logic-cheat-sheet
With access to Mapping Manager you can do more than just map a token from one field to the other - you also have the ability to write logic custom to your system that can perform various small tasks, and even base those on conditional requirements of your choosing.
Below is a list of functions and some of their many uses!
@ABS(Value)
Value: Token or hardcoded value
returns : value (in positive form)
The "absolute" function or @ABS() - simply acts like finding the absolute in mathematics - by taking the token or value inputted and converts it into a positive number.
@CASE
@CASE(Value,DefaultTranslation,CompareValue1,TranslationValue1,...)
Value: Token
DefaulTranslation: The value/result to use if no match is found (fallback value)
CompareValue1: Comparison value/token against Value variable
TranslationValue1: Return value/token if CompareValue1 equals true
A @CASE statement allows logic that will look at a single token and compare it against multiple values in which will return the most appropriate result based on that comparison.
Only a single return will result at any given time
@COPY
@COPY(Token,StartPosition,CopyLength)
Token: value to alter
Start Position: Position within the Token to start at
Copy Length: How many characters to copy
return: substring of Token
A @COPY statement takes a given value, and will return a new value based on how where and how many characters you wish to copy.
Uses
Produce only part of a value
Cap the length of a value
@DATEADD(Token,DaysToAdd)
Token: Date Token to modify
DaysToAdd: How many +/- days to Add/Subtract from Date Token
return: Modified Date
Modifies a given Date by adding or subtracting days to it
@IF_THEN_ELSE()
@IF_THEN_ELSE(Value1,ComparisonType,Value2,ValueIfTrue,ValueIfFalse)
Value1: First Value/Token to compare
ComparisonType: Comparison Operator
Value2: Second Value/Token to compare
ValueIfTrue: Result to return if Value1 compares to Value2 based on Comparison Type
ValueIfFalse: Result to return if comparison of Value 1 and Value 2 failed
Provides the ability to check a value, and produce a result based on whether a match was found or not
Condition | Symbol |
Equals | = |
Not Equal | <> |
Greater Than | > |
Less Than | < |
Greater Than or Equal To | >= |
Less Than or Equal To | <= |
@IF_AND_THEN_ELSE()
@IF_AND_THEN_ELSE(Value1,CompareType,Value2,Value3,CompareType,Value4,...,ValueIfTrue,ValueIfFalse)
Provides the ability to require multiple conditions to return true before returning the true value
@IF_OR_THEN_ELSE()
@IF_OR_THEN_ELSE(Value1,CompareType,Value2,Value3,CompareType,Value4,...,ValueIfTrue,ValueIfFalse)
Provides the ability to require any condition to evaluate as true in order to return the true value
@INT()
@INT(TOKEN,shift,size)
Turns a Value into an Integer
@INSTR()
@INSTR(Token,Substring)
Token: The token/value to search against
Substring: The character/word to look for within Token
return: Starting position of Substring (if found) - otherwise -1
Find the start Position of a Specific Character or Word
@IS_NUMERIC()
@IS_NUMBERIC(TOKEN)
Returns 1 if Token is fully numeric or 0 if contains string-based characters
@IS_TRANSLATABLE()
@LEN()
@LEN(TOKEN)
Returns how many characters make up Token
@LOWER_CASE(TOKEN)
Converts any upper-cased characters to lower
@NUM(TokenCalculation)
TokenCalculation: Combination of Token or Hardcoded value
Wrapper for performing mathematic calculations within a field
Operator | Sign |
Add | + |
Subtract | - |
Multiply | * |
Divide | / |
@NUM(@SUM(@NUM()))
@NUM(@SUM(@NUM(Token)))
Token:
returns: Sum of all entries
Totals all found entries with a math calculation added
โ
@REAL_ROUND
@REAL_ROUND(TOKEN,DecimalPlaces)
Rounds Token up to the specific DecimalPlaces defined
Note
Uses Banker's Rounding (rounds from .6 and up, rather than .5)
@REAL_TRUNCATE()
@REAL_TRUNCATE(TOKEN,DecimalPlaces)
Drops any decimal places within Token beyond the DecimalPlaces definition
@REPLACE_STRING
@REPLACE_STRING(Token,SearchFor,ReplaceWith)
Token: The token to modify/search
SearchFor: Character/Value/Word to find
ReplaceWith: Character/Value/Word to replace SearchFor value with(if found)
Finds a character/value/word and replaces it with the desired text
@STRIP_CHARS()
@STRIP_CHARS(Token,CharactersToStrip)
Token: The token to modify/strip from
CharactersToStrip: Characters (individual) to strip
Removes all characters found within the value/token
Note
CharactersToStrip is a list, not a whole word - if you enter "ABC" it will not strip all words of ABC, but rather strip all As, all Bs, and all Cs from your incoming Token regardless of their position.
@SIGN()
@SIGN(TOKEN)
Returns + or - sign based on if Token value is positive or negativegative
@SUM()
@SUM(TOKEN)
Totals all found entries of Token
@SWITCH()
@SWITCH(Value1,Value2,Value3,...)
Selects the first value (from left to right) that is not empty (NULL)
@TRIM
@TRIM(TOKEN)
Removes any white spaces found
@TRIM_LEFT
@TRIM_LEFT(TOKEN)
Removes any white spaces found on the left
@TRIM_RIGHT
@TRIM_RIGHT(TOKEN)
Removes any white spaces found on the right
@UNESCAPE()
@UNESCAPE(TOKEN)
@UPPER_CASE()
@UPPER_CASE(TOKEN)
Converts any lower-cased characters to upper-case
Resources
rev 11/2/22