Search Knowledge Base by Keyword

Summary Function

Create two Template Tags: Sum and GetSumValue. Attach the following script to the tag Sum. Tag Sum all TextInputs in your Template that shall be summarized. Tag GetSumValue a TextInput where you want to have the summarized value.

const Tags = LEGITO.documentBuilder.getTagsByName(“Sum”);

var finder = LEGITO.documentBuilder.event.createElementFinder();
var sumValues = finder.findElementsByTagsAuto(Tags);

const Results = LEGITO.documentBuilder.getTagsByName(“GetSumValue”);
var resultElement = finder.findElementsByTagsAuto(Results)[0];

let valuesArray = []
for(var i in sumValues) {
if(sumValues[i].getValue() !== null) {

let arrSum = valuesArray.reduce((a,b) => parseInt(a) + parseInt(b), 0);