Expressions - Strings

Depending on your particular software application it may not be possible to change your data before sending it to Docmosis.

Docmosis has a range of String functions you can use within the templates to format your data and achieve the desired result in your generated documents.


It is best to view the TEMPLATE and OUTPUT files side-by-side to understand the functions and their effect.


1) Working with Strings

Fixed or Static strings in your templates should be formed using single quotes.

<<cs_{gender=’male’}>> This person is a Male. <<es_>>

In the above example: 'male', is a fixed string that is being used for comparison in the Conditional Section.


2) Changing Case

Your input data can be easily Case converted using built-in functions like:

toLowerCase:  the final sentence will be all lower case
titleCase:  The Final Sentence Will Be In Title Case

For a full list of String functions see the Quick Reference.


3) Mapping your Data

With Docmosis you can "map" your input data to the desired output.

For example, this:

<<{map(toUpperCase(gender), ‘M’, ’Male’, ‘F’, ‘Female’, ‘Other’)}>>

Will achieve this:

  Input Data     Desired Output  
f Female
F Female
m Male
M Male
(all other letters) Other


4) Displaying List Data in Sentences

The example template shows how to loop through a list of values and display them in a comma separated sentence like this:

Input Data:

"apples", "bananas", "oranges".

Desired sentence in finished document:

My favorite fruits are apples, bananas and oranges.

The challenge is to include just enough "commas" and finish the sentence with an "and".

By using a combination of looping/testing/built-in-variables, this type of output can be achieved with Docmosis.

TRY: Changing the number of "fruit" in the data to see the effect in the finished document.


Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input

Applies To

Docmosis-Java Tornado Cloud
Version(s) 4.0.3, 4.1.0, 4.2.0, 4.3.0, 4.3.1, 4.4.0, 4.4.1, 4.4.2, 4.5.0, 4.6.0 (Latest) 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.8.0, 2.8.1, 2.8.2 (Latest) ALL

Related items