FAQs
Support
Customer Login

CrescoData CML

Cresco Mapping Language

Welcome to our CML integration page.

Use the CrescoData Commerce Connect Platform to integrate to over 100 commerce channels.

The available CML mapping features are on the left. Code examples are shown on the right. If you can’t find what you are looking for please email support@crescodata.com

currency

Description

Convert a value's currency

Attributes


source_currency
currency
Required

The currency to convert from (the input/source value currency)

destination_currency
currency
Required

The currency to convert into

value
number, price
Required

The value to convert
Sample
currency source_currency "value" destination_currency "value" value "value"

optional

Description

Removes and clears this attribute if the given value is null, false or empty

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The value to check
Sample
optional value "value"

replace_empty

Description

Replaces null, empty, false and empty lists, with the given new value

Attributes


new
url, richtext, currency, country, multiline_text, text
Required

The new value to replace with

value
url, richtext, currency, country, multiline_text, text
Required

The value to check
Sample
replace_empty new "value" value "value"

replace_not_empty

Description

Replaces values which are not null, empty, false, or an empty list with the given new value

Attributes


new
url, richtext, currency, country, multiline_text, text
Required

The new value to replace with

value
url, richtext, currency, country, multiline_text, text
Required

The value to check
Sample
replace_not_empty new "value" value "value"

earliest

Description

Chooses the earliest date, give a list of dates

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

None
Sample
earliest sources "value"

relative_timestamp

Description

Create and add or subtract from a date.

Attributes


years
number, price

The number of years to add. Supports a negative number to subtract

months
number, price

The number of months to add. Supports a negative number to subtract

weeks
number, price

The number of weeks to add. Supports a negative number to subtract

days
number, price

The number of days to add. Supports a negative number to subtract

hours
number, price

The number of hours to add. Supports a negative number to subtract

minutes
number, price

The number of minutes to add. Supports a negative number to subtract

seconds
number, price

The number of seconds to add. Supports a negative number to subtract

microseconds
number, price

The number of micro seconds to add. Supports a negative number to subtract

timezone
timezone

The timezone to convert the date into

date
url, richtext, currency, country, multiline_text, text

The date. If not given, will default to the current processing time.
Sample
relative_timestamp years "value" months "value" weeks "value" days "value" hours "value" minutes "value" seconds "value" microseconds "value" timezone "value" date "value"

is_future

Description

Whether the given date is in the future

Attributes


value
datetime, date
Required

The date to check

relative_to
datetime, date

Whether its in the future, relative to this date. If not provided, assumes the current date of processing
Sample
is_future value "value" relative_to "value"

raise_exception

Description

Raises an exception when an error occurs

Attributes


message
url, richtext, currency, country, multiline_text, text
Required

None

system_identifier
url, richtext, currency, country, multiline_text, text

None
Sample
raise_exception message "value" system_identifier "value"

html

Description

Wraps your text with an HTML tag.

Attributes


tag
url, richtext, currency, country, multiline_text, text

The tag to wrap around your text

value
url, richtext, currency, country, multiline_text, text
Required

The text to wrap the tag around.
Sample
html tag "value" value "value"

html2text

Description

Extracts text from your HTML.

Attributes


separator
url, richtext, currency, country, multiline_text, text

The separator to use between the text detected between HTML tags.

value
url, richtext, currency, country, multiline_text, text

The HTML value
Sample
html2text separator "value" value "value"

markup

Description

Converts HTML into text with a markup language

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The HTML value
Sample
markup value "value"

html_exclude_tags

Description

Excludes a list of HTML tags.

Attributes


tags
url, richtext, currency, country, multiline_text, text
Required

The list of HTML tags to exclude, separated by comma.

value
url, richtext, currency, country, multiline_text, text
Required

The HTML value
Sample
html_exclude_tags tags "value" value "value"

html_exclude_hidden

Description

Excludes HTML elements with display: none

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The HTML value
Sample
html_exclude_hidden value "value"

all_equals

Description

Check whether all values in the list equals to your given value

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The value to check the equality against

sources
url, richtext, currency, country, multiline_text, text
Required

The list of values
Sample
all_equals value "value" sources "value"

all_true

Description

Whether all the values in the list is a non-empty, non-null, and non-false value

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

The list of values to check
Sample
all_true sources "value"

any_true

Description

Whether any item in the list is a non-empty, non-null, or non-false value.

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

The list of values to check
Sample
any_true sources "value"

exclude

Description

Excludes empty strings, nulls, false and empty list values

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

The list of values to check

excludes
array

Leave empty to exclude null, empty and false values
Sample
exclude sources "value" excludes "value"

first_not_empty

Description

By default, picks the first non-empty, non-null, and non-false value from a list of values. Returns null if all values are excluded

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

The list of values to check

excludes
array

If the value of a list item matches one of these values, it will be skipped
Sample
first_not_empty sources "value" excludes "value"

index

Description

Get an item from a list with the given index.

Attributes


index
url, richtext, currency, country, multiline_text, text
Required

The index to grab from the list. Note that 0 is the first item, 1 is the second item, etc. Use -1 to grab the last item, -2 for 2nd last, etc.

sources
url, richtext, currency, country, multiline_text, text
Required

The list of values
Sample
index index "value" sources "value"

join

Description

Join a list of values with a given text separator, such as a comma, full-stop, etc.

Attributes


separator
url, richtext, currency, country, multiline_text, text

The separator to join the list of items with

sources
url, richtext, currency, country, multiline_text, text
Required

The list of values to be joined
Sample
join separator "value" sources "value"

length

Description

Get the length of a list

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

None
Sample
length sources "value"

merge

Description

Merges multiple lists into a single bigger list

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

The list of lists to be merged into one single list
Sample
merge sources "value"

remove_duplicates

Description

Removes duplicate values from a list

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

The list of values to remove duplicates from
Sample
remove_duplicates sources "value"

length_greater_than

Description

Whether the length of the list or text is greater than a value

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

None

value
number, price
Required

None
Sample
length_greater_than sources "value" value "value"

length_less_than

Description

Whether the length of the list or text is less than a value

Attributes


sources
url, richtext, currency, country, multiline_text, text
Required

None

value
number, price
Required

None
Sample
length_less_than sources "value" value "value"

remove_items

Description

Values to filter from a list

Attributes


source
url, richtext, currency, country, multiline_text, text
Required

The list of values to check

case_sensitive
boolean

Whether the check is case sensitive.

partial_match
boolean

Whether to partially match.

filter_out
boolean

Whether to remove items matching this filter. Set to False to include items matching this filter

values
multiline_text
Required

The values to filter
Sample
remove_items source "value" case_sensitive "value" partial_match "value" filter_out "value" values "value"

not

Description

Flips the boolean value

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The value to check
Sample
not value "value"

equals

Description

Check equality

Attributes


comparison
url, richtext, currency, country, multiline_text, text
Required

The value to compare against

value
url, richtext, currency, country, multiline_text, text
Required

The value to compare

case_sensitive
boolean

Whether to check equality with case sensitivity.
Sample
equals comparison "value" value "value" case_sensitive "value"

not_equals

Description

Check non-equality

Attributes


comparison
url, richtext, currency, country, multiline_text, text
Required

The value to compare against

value
url, richtext, currency, country, multiline_text, text
Required

The value to compare

case_sensitive
boolean

Whether to check non-equality with case sensitivity.
Sample
not_equals comparison "value" value "value" case_sensitive "value"

is_not_null

Description

Whether the given value is not null

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_not_null value "value"

is_null

Description

Whether the given value is null

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_null value "value"

is_empty

Description

Check whether the given value is an empty string, null, false, or an empty list of items.

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_empty value "value"

is_not_empty

Description

Check whether the given value is not an empty string, null, false, or an empty list of items.

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_not_empty value "value"

is_false

Description

Check whether the given value is a false boolean value

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_false value "value"

is_true

Description

Check whether the given value is a true boolean value

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_true value "value"

bool

Description

Returns true if your value is true, y, or 1 (case and type insensitive), otherwise, returns false

Attributes

Sample
bool

is_falsy

Description

Returns true if your value is false, n, or 0 (case and type insensitive), otherwise, returns false

Attributes

Sample
is_falsy

equals_one_of

Description

Check equality against multiple values

Attributes


comparison
multiline_text
Required

The value to compare against

value
url, richtext, currency, country, multiline_text, text
Required

The value to compare

case_sensitive
boolean

Whether to check equality with case sensitivity.
Sample
equals_one_of comparison "value" value "value" case_sensitive "value"

not_equals_one_of

Description

Check non-equality against multiple values

Attributes


comparison
multiline_text
Required

The value to compare against

value
url, richtext, currency, country, multiline_text, text
Required

The value to compare

case_sensitive
boolean

Whether to check in-equality with case sensitivity.
Sample
not_equals_one_of comparison "value" value "value" case_sensitive "value"

is_numeric

Description

Whether the given value is a number

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_numeric value "value"

is_list

Description

Check whether the given value is an array.

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
is_list value "value"

add

Description

Sums together a list of values

Attributes


sources
number, array, price
Required

None
Sample
add sources "value"

add_rate

Description

Increase a number or price by a percentage rate

Attributes


rate
number, price
Required

The percentage to increase by

value
number, price
Required

The value to be added to
Sample
add_rate rate "value" value "value"

subtract

Description

Subtracts numbers from a list of numbers

Attributes


sources
number, array, price
Required

None
Sample
subtract sources "value"

subtract_rate

Description

Subtracts by a percentage rate

Attributes


rate
number, price
Required

The percentage to subtract

value
number, price
Required

The value to be subtracted from

use_multiplier
boolean

Whether to use "value - (value * rate / 100)". Otherwise uses "value / (rate / 100 + 1)"
Sample
subtract_rate rate "value" value "value" use_multiplier "value"

multiply

Description

Multiplies a list of values

Attributes


sources
number, array, price
Required

None
Sample
multiply sources "value"

divide

Description

Divides a list of values

Attributes


sources
number, array, price
Required

None
Sample
divide sources "value"

max

Description

Gets the maximum number out of a list of numbers

Attributes


sources
array
Required

The list of numbers
Sample
max sources "value"

min

Description

Gets the minimum number out of a list of numbers

Attributes


sources
array
Required

The list of numbers
Sample
min sources "value"

round

Description

Round the value to a given decimal point

Attributes


decimals
number, price
Required

The number of decimals to round to. Give 0 to turn into an integer.

value
url, richtext, number, currency, price, country, multiline_text, text
Required

The value to round
Sample
round decimals "value" value "value"

greater_than

Description

Checks if the value is greater than the comparison value

Attributes


comparison
datetime, number, price, date
Required

None

value
datetime, number, price, date
Required

The value to check
Sample
greater_than comparison "value" value "value"

greater_than_or_equals

Description

Checks if the value is greater than or equals to the comparison value

Attributes


comparison
datetime, number, price, date
Required

None

value
datetime, number, price, date
Required

The value to check
Sample
greater_than_or_equals comparison "value" value "value"

less_than

Description

Checks if the value is less than the comparison value

Attributes


comparison
datetime, number, price, date
Required

None

value
datetime, number, price, date
Required

The value to check
Sample
less_than comparison "value" value "value"

less_than_or_equals

Description

Checks if the value is less or equals to the comparison value

Attributes


comparison
datetime, number, price, date
Required

None

value
datetime, number, price, date
Required

The value to check
Sample
less_than_or_equals comparison "value" value "value"

abs

Description

Take the absolute value of a give number - turns negatives to positives.

Attributes


source
url, richtext, currency, country, multiline_text, text
Required

The value to take the absolute value of
Sample
abs source "value"

lower

Description

Convert the text to all lowercase

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text to make lowercase
Sample
lower value "value"

title

Description

Capitalizes the first letter of each word in your text

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text to be capitalized
Sample
title value "value"

upper

Description

Convert the text to all uppercase

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text to make uppercase
Sample
upper value "value"

split

Description

Splits your string into multiple components, given by a separator. Returns a list of text.

Attributes


separator
url, richtext, currency, country, multiline_text, text

The separator to split by

value
url, richtext, currency, country, multiline_text, text
Required

The text to split

max_split
number, price

The maximum number to split by. Will ignore the separator after this many occurrences are found
Sample
split separator "value" value "value" max_split "value"

strip

Description

Removes any spaces from the begging or end of your text

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text to trim

char
url, richtext, currency, country, multiline_text, text

The character to trim, leave empty to trim spaces or extra lines
Sample
strip value "value" char "value"

append_text

Description

Append a text to the end of a given value

Attributes


text
url, richtext, number, currency, price, country, multiline_text, text
Required

None

value
url, richtext, currency, country, multiline_text, text
Required

The value to be appended to
Sample
append_text text "value" value "value"

prepend_text

Description

Prepend a text to the beginning of a given value

Attributes


text
url, richtext, currency, country, multiline_text, text
Required

None

value
url, richtext, currency, country, multiline_text, text
Required

The value to be prepended to
Sample
prepend_text text "value" value "value"

shorten

Description

Cut and shorten the text to the maximum length provided. Appends ... to the end of your text.

Attributes


max_length
number, price
Required

The maximum length. This will be subtracted by 3 and have ... added to the end of your text.

value
url, richtext, currency, country, multiline_text, text
Required

The text to be shortened
Sample
shorten max_length "value" value "value"

nice_cut

Description

Shortens and cuts your text without cutting off sentences.

Attributes


limit
number, price
Required

The maximum output length of the text. Your output may be less than this length, depending on the sentence structure.

value
url, richtext, currency, country, multiline_text, text
Required

The text to be shortened nicely.
Sample
nice_cut limit "value" value "value"

ends_with

Description

Checks whether your text ends with a certain text. Returns either true or false.

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text value to check against

comparison
url, richtext, currency, country, multiline_text, text
Required

None
Sample
ends_with value "value" comparison "value"

starts_with

Description

Checks whether your text starts with a certain text. Returns either true or false.

Attributes


comparison
url, richtext, currency, country, multiline_text, text
Required

The text to check for

value
url, richtext, currency, country, multiline_text, text
Required

The text value to check against
Sample
starts_with comparison "value" value "value"

replace

Description

Replace the given value with a new one, if matches.

Attributes


old
url, richtext, currency, country, multiline_text, text
Required

The value to check against

new
url, richtext, currency, country, multiline_text, text
Required

The value to replace with, if equals

value
url, richtext, currency, country, multiline_text, text
Required

None
Sample
replace old "value" new "value" value "value"

contains_text

Description

Check whether a text contains a given sub-text

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text to check for

case_sensitive
boolean

Whether the check is case sensitive.

source
url, richtext, currency, country, multiline_text, text
Required

The source text
Sample
contains_text value "value" case_sensitive "value" source "value"

not_contains_text

Description

Check whether a text does not contains a given sub-text

Attributes


value
url, richtext, currency, country, multiline_text, text
Required

The text to check for

case_sensitive
boolean

Whether the check is case sensitive.

source
url, richtext, currency, country, multiline_text, text
Required

The source text
Sample
not_contains_text value "value" case_sensitive "value" source "value"

map

Description

Provide a mapping of the current value into a different value.

Attributes


mappings
url, richtext, currency, country, multiline_text, text
Required

Use -> to indicate a mapping. For example: this -> that

default
url, richtext, currency, country, multiline_text, text

The default value if your value did not match any mappings
Sample
map mappings "value" default "value"

partial_remove

Description

Removes parts of your specified text.

Attributes


text
url, richtext, currency, country, multiline_text, text
Required

The text to replace

count
number, price

The maximum number of removals to do. Leave empty to replace all occurrences

case_sensitive
boolean

Whether the removals are case sensitive. Setting to false will also use Regular Expression

use_regex
boolean

Whether the removal should check using regular expression

value
url, richtext, currency, country, multiline_text, text
Required

The full text to be checked for removal
Sample
partial_remove text "value" count "value" case_sensitive "value" use_regex "value" value "value"

partial_replace

Description

Replaces parts of your value with a new text.

Attributes


old_text
url, richtext, currency, country, multiline_text, text
Required

The text to replace

new_text
url, richtext, currency, country, multiline_text, text
Required

Replace the text with

count
number, price

The maximum number of removals to do. Leave empty to replace all occurrences

case_sensitive
boolean

Whether the removals are case sensitive. Setting to false will also use Regular Expression

use_regex
boolean

Whether the removal should check using regular expression

value
url, richtext, currency, country, multiline_text, text
Required

The full text to be checked for removal
Sample
partial_replace old_text "value" new_text "value" count "value" case_sensitive "value" use_regex "value" value "value"

contains_one_of_text

Description

Check whether a text contains given sub-texts

Attributes


values
multiline_text
Required

The values to check for

case_sensitive
boolean

Whether the check is case sensitive.

source
url, richtext, currency, country, multiline_text, text
Required

The source text
Sample
contains_one_of_text values "value" case_sensitive "value" source "value"

not_contains_one_of_text

Description

Check whether a text does not contains given sub-texts

Attributes


values
multiline_text
Required

The text to check for

case_sensitive
boolean

Whether the check is case sensitive.

source
url, richtext, currency, country, multiline_text, text
Required

The source text
Sample
not_contains_one_of_text values "value" case_sensitive "value" source "value"

price

Description

Convert the input into a price.

Attributes

Sample
price

timestamp

Description

Convert into a date format from a timestamp

Attributes


timezone
timezone

The timezone to convert to
Sample
timestamp timezone "value"

date

Description

Re-format a date into your specified format

Attributes


source
url, richtext, currency, country, multiline_text, text
Required

None

from_format
url, richtext, currency, country, multiline_text, text

None

from_format_2
url, richtext, currency, country, multiline_text, text

None

to_format
url, richtext, currency, country, multiline_text, text

Use formats such as %Y %m %d %m %s

timezone
url, richtext, currency, country, multiline_text, text

None

to_timezone
timezone

The timezone to convert the date into
Sample
date source "value" from_format "value" from_format_2 "value" to_format "value" timezone "value" to_timezone "value"

country

Description

Converts country names (case-insensitive) into the appropriate 2 letter country code. Returns the country name that was given if no match is found.

Attributes


country
url, richtext, currency, country, multiline_text, text
Required

The country name to be converted into the country code

use_smart_matching
boolean

Whether to use partial-text matching to find the most appropriate country code.
Sample
country country "value" use_smart_matching "value"

integer

Description

Convert the input into an integer.

Attributes

Sample
integer