Template Functions

There are a number of functions you can use inside the templating language. Functions must appear inside of braces.

{{ upperCaseFirstLetter('jim') }}

The following is a complete list of available functions.

Function Description Example Output
absoluteValue(number) Returns the absolute value of a number. absoluteValue(2)
absoluteValue(-2)
2
2
ceiling(decimal) Returns the largest integer from a decimal number. ceiling(4.2) 5
centerMeX()
Returns the left corner position needed to center the current layer within the design. Can also take a parameter to center itself inside another layer. centerMeX()
centerMeX('layer name')
75
125
centerMeY()
Returns the top corner position needed to center the current layer within the design. Can also take a parameter to center itself inside another layer.
centerMeY()
centerMeY('layer name')
75
125
cosine(number) Returns the cosine of the number. cosine(0) 1
endsWith(str, end) Returns true if the last characters of str match end. endsWith('Fred','ed')
endsWith('Fred','er')
true
false
floor(decimal) Returns the smallest integer from a decimal number. floor(4.2) 4
get(variable) Returns a variable set earlier using the set() function. get('foo') bar
inList(test, val1, val2, val3) Returns true if test is equal to any of the values. Accepts any number of parameters. inList('red', 'green', 'blue', 'black')
inList('red', 'green', 'red', 'black')
false
true
inText(str, inc)
Returns true if inc is found anywhere inside of str. inText('Fred', 'red') 
inText('Fred', 'foo')
true 
false
join(sep, str1, str2, str3) Concatenates all of the str with the sep. Accepts any number of parameters. join('//', 'green', 'red', 'yellow') green//red//yellow
layerBottom(name) Returns the Y position of the bottom of the named layer. layerBottom('layer name') 200
layerHeight(name) Returns the height of the named layer. layerHeight('layer name') 100
layerLeft(name) Returns the X position of the left-side of the named layer. layerLeft('layer name') 40
layerRight(name) Returns the X position of the right-side of the named layer. layerRight('layer name') 70
layerTop(name) Returns the Y position of the top of the named layer. layerTop('layer name') 25
layerWidth(name) Returns the width of the named layer. layerWidth('layer name') 300
lowerCase(string) Lower cases a string. lowerCase('aBcDeF') abcdef
length(string) Returns the number of characters in a string. length('crafter') 7
max(number, max) Returns a number equal to or lower than the max. max(5,3)
max(1,3)
3
1
min(number, min) Returns a number equal to or higher than the min. min(5,3)
min(1,3)
5
3
plural(str, num, inclusive) Allows you to create pluralized text in an easy manner based upon what the value of the integer is.
plural('test')
plural('test', 0)
plural('test', 1)
plural('test', 5)
plural('test', 1, true)
plural('test', 5, true)
plural('蘋果', 2, true)

tests
tests
test
tests
1 test
5 tests
2 蘋果

pi A constant holding the value of PI. pi 3.14159265359
random(min, max) Returns a random integer between two integers (inclusive). randint(1,10)
randint(1,10)
randint(1,10)
3
1
9
range(number, min, max) Returns a number between min and max (inclusive). range(1,3,5)
range(3,1,5)
range(5,1,3)
3
3
3
replace(string, find, replace) Replaces 1 string with another inside a third string. replace('Text','x', 'X')
replace('Text','', ' - ')
replace('Requires 3 water.', 'water', '<water/>')
TeXt
T - e - x - t
Requires 3 <water/>.
round(decimal) Returns the smallest integer from a decimal number if the remainder is less than 5 or the highest when it's 5 or above. round(4.2) 4
set(variable, value) Set a variable for retrieval later. set('foo','bar')
setget(variable, value) Set a variable for retrieval later, but also output it now. setget('foo','bar') bar
sine(number) Returns the sine of the number. sine(0) 0
squareRoot(number) Returns the square root of the number. squareRoot(4) 2
startsWith(str, start) Returns true if str begins with start. startsWith('Food','Foo')
startsWith('Food','Bar')
true
false
substring(str, start, length) Returns a portion of a string. substring('Component', 1, 2)
substring('Component', 0, 4)
om
Comp
upperCase(string) Upper cases a string. upperCase('aBcDeF') ABCDEF
upperCaseFirstLetter(string) Upper cases the first letter in a string. upperCaseFirstLetter('aBcDeF') ABcDeF
upperCaseEachWord(string) Upper cases the first letter in each word in the string. upperCaseEachWord('component studio') Component Studio

There are also a number of functions provided just for dealing with Advanced Tables.

Still need help? Contact Us Contact Us