You are currently viewing documentation for Linnworks Desktop, if you are looking for documentation, click here.



Expressions in Linnworks is a way of outputting data from the system based on a mathematical or functional expressions. This functionality applies to printing functions (printing invoices, labels), generating emails, running macro scripts and data export/import automation.

For example if you wanted to create a new field on an invoice which will contain some calculated value you can use Output Formula Value in the text field in the Template Designer and code the expression to output the desired result.




Boolean Not


Performs a boolean Not operator on the parameter a. For example, Not[true] = false.



eval[r]  - where r is any valid Rule Basic string rule

Evaluates a Rule Basic string. I think this is an interesting operand function. In my Rules Engine, I may have rules that return a Rules Basic string. Then the result could be evaluated with this operand

function. That is, have rules that create other rules. Example: eval[concat["a:=5;", "b:=6;", "a+b"]]



iif[c, a, b] - where c is the condition and must evaluate to a Boolean. The value a is returned if c is true, otherwise, the value b is returned.

Performs an if-else-end


Is all digits


Returns true/false indicating if the parameter is all digits. For example, IsAllDigits["1234"] = true


Is Null or Empty


Indicates is the parameter is null or empty.


Is True or Null


Indicates if the parameter has the value true or is null;


Is False or Null


Indicates if the parameter has the value false or is null




Absolute Value

abs[p1] - where p1 can be converted to a double.

Calculates the absolute value of a numeric parameter.



avg[p1, ..., pn] - where p1,...,pn can be converted to doubles

Calculates the average of a list of numbers. The list items must be able to convert to doubles.



between[var, val1, val2] - where var, val1, and val2 are integers. if var >= val1 and var <= val2 then the function returns "true", otherwise, the function return "false".

Indicates if a value is between the other values. Please note that the comparison is inclusive.



NumericMax[p1, ..., pn]

Finds the maximum numeric value in a list



mid[p1, ..., pn] - where p1, ..., pn are numeric values

Calculates the median for a list of numbers



NumericMin[p1, ..., pn]

Finds the numeric minimum value in a list




Returns numeric value, 2 decimal places. For example N2[100/3] returns 33.33



round[n, d] - where n is the numeric value to be rounded, and d is the number of decimal places.

Rounds a numeric value to the number of decimal places


Sin Wave


Calculates the sin of a number


Square Root

sqrt[a] - where a is a numeric parameter

Calculates the square root of a number.





concat[p1, ..., pn]

This operand function concatenates the parameters together to make a string.



contains[p1, p2, ...., pn] If p1 is in the list p2, ..., pn, this function returns "true" otherwise, this function returns "false".

Indicates if the item is contained in the list.


Double Quote


Returns a double quote


Index Of

indexof[a, b1, ..., bn] - If the list b1, ..., bn contains the value a, the index of the value is returned, otherwise, -1 is returned. Please note that this is zero based indexing

Returns the index of a list item.



join[a, b1, ..., bn] - where a is the delimiter and b1, ..., bn are the items to be joined.

Joins a list of items together using a delimiter.



left[s, n] - where s is the string and n is the number of characters

Returns the left number of characters from a string parameter.

Example for Template Designer:

a:=IIF[len[[{ItemTitle}]] < 10, len[[{ItemTitle}]], 10 ]; 

Left Pad

lpad[a, b, n] - where a and b are string values and n is numeric. The parameter p will be appended to the left of parameter a, n times.

Pads a string on the left with new values

Left Trim


Trims the spaces from the left of a string


len[a] - where a is a string variable

Returns the length of a string


Lower Case


Converts a string to lower case



StringMax[p1, ..., pn]

Finds the maximum string in the list



StringMin[p1, ..., pn]

Finds the minimum string in the list


Proper Case

pcase[a] - where a is a string

Converts a string to Proper Case. For example, the proper case of "buFFalo" "Buffalo"



remove[a, b] - where a and b are string

Removes the specified characters from the string



Replace[a, b, c] - where a is the search string, b is the value being replaced, and c is the value that is being inserted

Example For Template Designer
EVAL{BEGIN}Replace[[{ExternalReference}], "MAGENTO",""]{END}

Replaces one string with another string



right[s, n] - where s is the string and n is the number of characters.

Returns the right number of characters from a string parameter


Right Pad

rpad[a, b, n] - where a and b are string values and n is numeric. The parameter b will be appended to the right of parameter a, n times.

Pads a string on the right with new values


Right Trim


Trims the spaces from the right of a string


Search String

SearchString[a, n, b] - where a is the string that is being searched, b is the string that is being sought, and n is the start position in a

Searches for a string within another string at a specified starting position


Sub String

SubString[s, a, b] - where s is the string, a is the starting point, and b is the number of characters extracted.

Extracts a substring from a string




Trims the spaces from the entire string. Please note that it does not remove spaces from the text itself, it only removes spaces from the start and the end of the string. In order to remove spaces from the text, please consider using replace[]


Upper Case


Converts a string to upper case




Date and Time


Date Add

dateadd[date, "type", amount] - where date is a valid date, and type is "y", "m", "d" or "b" (representing year, month, day, or business days) and amount is an integer

Adds an amount to a date. Please note that the amount may be negative.



day[d1] - where d1 is a date value

Returns the day of a date


Day Of Week


Returns a day string. For example dayofweek[today[]] returns Wednesday.  

Note: dayofweek[now[]] will not work. Use dayofweek[nowf[]] instead.




Returns numeric value. For example hour[nowf[] returns 12.



datemax[d1, ..., dn] - where d1, ..., dn are dates

Returns the maximum date in the list



datemin[d1, ..., dn] - where d1, ..., dn are dates.

Returns the minimum date in the list.



month[d1] - where d1 is a date value

Returns the month of a date


New Date

date[m, d, y] - where m is an integer and is the month, d is an integer and is the day, and y is an integer and is the year

Create a new date data type



now[] This operand function takes no parameters

Returns the current date


Now Formatted

Nowf[] Does not take any parameters.

Returns current time. For example NowF[] returns 2013-06-12 12:42:22


Now Format Date


Returns current time. For example:

Nowfd[""] returns 21/06/2013 12:42:22 (default format)

nowfd["ddd, dd MMM yyyy HH:mm:ss zzzz"] returns Fri, 21 Jun 2013 16:55:50 +01:00 (RFC 2822 format)

nowfd["dddd, dd MMM yyyy HH:mm:ss zzzz"] returns Friday, 21 Jun 2013 16:55:50 +01:00

For more info please visit:



ParseDateTime[date, inputformat , outputformat]

Returns a given the date in the outputformat specified. 

ParseDateTime["2013-08-18","yyyy-MM-dd","MMM dd yyyy"]  returns Aug 18 2013

ParseDateTime["8/18/2013","M/d/yyyy","d/M/yyyy HH:mm:ss"]  returns 18/8/2013 00:00:00

The inputformat needs to match the date/time format on your machine. To retrieve the current format of your dates, e.g. the dReceievedDate, use EVAL{BEGIN}[{dReceievedDate}]{END}

Example: ParseDateTime[[{dReceievedDate}], "dd/MM/yyyy HH:mm:ss", "dd MM yyyy"] returns 18 08 2013

Date Format Descriptions



Today[] Does not take any parameters.

Returns today's date. For example Today[] returns 2013-06-12



year[d1] - where d1 is a date

Returns the year of a date