Simple xpath

0
Hi, I'm creating counters to show how many people signed up to use the service last month. The youngperson entity has a datejoined attribute.  In the microflow that i'm using to count how many young people signed up i'm trying to write an xpath to filter the results to the people that joined last month with no luck. I'm aware this is probably very simple i just haven't had to use xpath for this purpose before and could do with some advice. Thanks C  
asked
3 answers
1

See the documentation here with the examples: https://docs.mendix.com/refguide/xpath-keywords-and-system-variables

So in your case something like

[$signupdate > '[%BeginOfCurrentDay%] - 4 * [%WeekLength%]']

Regards,

Ronald

 

 

answered
1

Create a variable $MonthStart of type Date and value [%beginofcurrentmonth%]

Use this xpath for retrieving

[datejoined >= $MonthStart]

That will return a list. Count the list with a list aggregation.

answered
0

Hi,

Chris nicely points out that you can use variables in your XPath expression which gives you much more flexibility.

For example you can define the following variable

$OneMonthBefore = addMonths([%BeginOfCurrentDay%],-1)

to go one month in the past. This is not possible directly in XPath because Xpath does not support the addMonths function.

The Xpath would then be

[datejoined >= $OneMonthBefore]

Hope this helps,

-Andrej

answered