cancel
Showing results for 
Search instead for 
Did you mean: 

Adding functions to Nintex Workflows with XLST transformations - Part 2 (COUNT, FLOOR, CEILING, ROUND, AVG)

fhunth
Nintex Newbie
2 0 822

Introduction

Going on with the series of "Adding functions to Nintex Workflows with XLST transformations", here is the Part 2 showing a sample with some new calculations using XLST.

You can see the Part 1 here >>> Adding functions to Nintex Workflows with XLST transformations - Sample 1 (SUM)

I 'll write about all xlst formulas that can be used in Nintex Workflow and currently are not available as inline functions.

Those different formulas will be updated on a common document with all formulas and samples.

More samples

Now we'll see the following formulas:

  • COUNT
  • FLOOR
  • CEILING
  • ROUND
  • AVG

Workflow

So let's start configuring the action named "Query XML"

On the XML I use

<?xml version='1.0'?>

<root>

  <expenditure>1000</expenditure>

  <expenditure>3000</expenditure>

  <expenditure>2000</expenditure>

</root>

On the XSLT I use the following template

<?xml version='1.0'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

COUNT : <xsl:value-of select='count(//expenditure)'/>

---

FLOOR: <xsl:value-of select='floor(1976.6)'/>

---

CEILING:<xsl:value-of select='ceiling(1976.6)'/>

---

ROUND:<xsl:value-of select='round(1976.6)'/>

---

AVG : <xsl:value-of select=' (sum(//expenditure))  div (count(//expenditure))  '/>

</xsl:template>

</xsl:stylesheet>

I left the result on the workflow history, where magically we can see the calculated result