How to implement count in x-path in Mendix..

How to implement count in xpath .
3 answers

Hi Manoj,

I see you just started out with Mendix. That's great! Some pointers though:

1. Most of your questions can be answered quite easily by following the Mendix Getting Started tutorials, which you can find here:

2. What have you tried to do already before asking the question?
Try to search the forum for answers first, search the reference guide (

3. Mendix XPath is an interpretation of standard XPath and doesn't contain the count function.
Also see my post here on Mendix XPath:

What you can do (based on your answer to Austin) is to make a microflow with two actions:

1. Retrieve from Database:
Retrieve type = Employee
XPath constraint = [Status = 'Active']

Output = List
Name = ActiveEmployeeList

2. Aggregate List:
Variable = ActiveEmployeeList
Function = Sum

Output = CountActiveEmployees <= this is what you were looking for with the XPath Count operation.

Good luck!

Kind regards,


Are you trying to limit the number of objects returned? In your retrieve activity you can set the limit to achieve this.

Here is some documentation on this

and a blog post


If you are trying to count the number of returned objects, use the aggregate list activity after your retrieve to count the  list.


try this :