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
price, number
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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The new value to replace with

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The new value to replace with

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None
Sample
earliest sources "value"

relative_timestamp

Description

Create and add or subtract from a date.

Attributes


years
price, number

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

months
price, number

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

weeks
price, number

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

days
price, number

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

hours
price, number

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

minutes
price, number

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

seconds
price, number

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

microseconds
price, number

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

timezone
timezone

The timezone to convert the date into

date
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None

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

None
Sample
raise_exception message "value" system_identifier "value"

html

Description

Wraps your text with an HTML tag.

Attributes


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

The tag to wrap around your text

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

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

html2text

Description

Extracts text from your HTML.

Attributes


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

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

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

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

markup

Description

Converts HTML into text with a markup language

Attributes


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

The HTML value
Sample
markup value "value"

html_exclude_tags

Description

Excludes a list of HTML tags.

Attributes


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

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

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The value to check the equality against

sources
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text

The separator to join the list of items with

sources
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None
Sample
length sources "value"

merge

Description

Merges multiple lists into a single bigger list

Attributes


sources
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None

value
price, number
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
currency, multiline_text, richtext, url, country, text
Required

None

value
price, number
Required

None
Sample
length_less_than sources "value" value "value"

remove_items

Description

Values to filter from a list

Attributes


source
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The value to check
Sample
not value "value"

equals

Description

Check equality

Attributes


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

The value to compare against

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The value to compare against

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None
Sample
is_not_null value "value"

is_null

Description

Whether the given value is null

Attributes


value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None
Sample
is_not_empty value "value"

is_false

Description

Check whether the given value is a false boolean value

Attributes


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

None
Sample
is_false value "value"

is_true

Description

Check whether the given value is a true boolean value

Attributes


value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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"

add

Description

Sums together a list of values

Attributes


sources
price, number, array
Required

None
Sample
add sources "value"

add_rate

Description

Increase a number or price by a percentage rate

Attributes


rate
price, number
Required

The percentage to increase by

value
price, number
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
price, number, array
Required

None
Sample
subtract sources "value"

subtract_rate

Description

Subtracts by a percentage rate

Attributes


rate
price, number
Required

The percentage to subtract

value
price, number
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
price, number, array
Required

None
Sample
multiply sources "value"

divide

Description

Divides a list of values

Attributes


sources
price, number, array
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
price, number
Required

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

value
currency, price, multiline_text, richtext, url, country, number, 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, date, price, number
Required

None

value
datetime, date, price, number
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, date, price, number
Required

None

value
datetime, date, price, number
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, date, price, number
Required

None

value
datetime, date, price, number
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, date, price, number
Required

None

value
datetime, date, price, number
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
currency, multiline_text, richtext, url, country, text
Required

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

lower

Description

Convert the text to all lowercase

Attributes


value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text to be capitalized
Sample
title value "value"

upper

Description

Convert the text to all uppercase

Attributes


value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text

The separator to split by

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

The text to split

max_split
price, number

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
currency, multiline_text, richtext, url, country, text
Required

The text to trim

char
currency, multiline_text, richtext, url, country, 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
currency, price, multiline_text, richtext, url, country, number, text
Required

None

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

None

value
currency, multiline_text, richtext, url, country, 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
price, number
Required

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

value
currency, multiline_text, richtext, url, country, 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
price, number
Required

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

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text value to check against

comparison
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text to check for

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The value to check against

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

The value to replace with, if equals

value
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text to check for

case_sensitive
boolean

Whether the check is case sensitive.

source
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text to check for

case_sensitive
boolean

Whether the check is case sensitive.

source
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

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

default
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text to replace

count
price, number

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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, text
Required

The text to replace

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

Replace the text with

count
price, number

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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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
currency, multiline_text, richtext, url, country, 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"

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
currency, multiline_text, richtext, url, country, 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