Counting using X-path

0
How to write X-path for counting total no. of users registered for a perticular date
asked
3 answers
1

Hi Shraddha,

 

XPath Query Functions would be the best bet in regards to using XPaths. 

You can find more info here: https://docs.mendix.com/refguide/xpath-count

 

Another option to ponder at is using some application logic to “Count” the number of objects in that list. 

You can find more info here: https://docs.mendix.com/refguide/aggregate-list

 

Hopefully, this will point you in the right direction!

 

answered
1

If you do a retrieve in a microflow of all the objects you want to count, then add a Count action afterwards (as described above), the database query is automatically optimised to only retrieve the count and not all the objects.

If you want to show this count on a page, store it in an object that's passed to a page.

 

Using an Xpath retrieve in a dataview requires the outcome to be one or multiple objects. Therefor using 'count’ to get a result won't help you much. For your use case, you must use a microflow and store the result.

answered
0

With "does not work” you mean that count = 0?

Play around with the constraint you use, which seems to be ok, so data is probably empty: [$DateSearch/StartDate <=Date and $DateSearch/EndDate>=Date]

First try without any constraint, see if count will be > 0.

than try: [$DateSearch/StartDate <= Date] and see if the count is reduced.

than try: [$DateSearch/StartDate <= Date] and see if the count is further reduced.

answered