Microflow ExclusiveSplit expression over an association

I tried simple split condition in Microflow over an association but I can´t figure out how to write xPath expression. I have the same model like PizzaMario sample project (Entity "Customer", entity "Order" and "Order_Customer" association 1:n between). Parametr for microflow is Object "PizzaMario.Customer". Now I want, lets say, promote Customer to VIP when atribut OrderNumber in entity "Order" will be "10". According to doc it could be something like this: //PizzaMario.Customer/PizzaMario.Order_Customer/PizzaMario.Order[OrderNumber=10] But there is not possible write two backslahes directly behind in Modeler / or in expression editor. So I assumed according to Expression wizard that right format for this could be: $Customer/PizzaMario.Order_Customer/PizzaMario.Order[OrderNumber=10] But it seems it is not right as well (error: missing EOF at '/'). Could you please advise me correct notation?
2 answers


You state that you're trying to set an xpath in an exclusive split. This will not work as xpaths can't be used there. You could try to retrieve the order from the database with an xpath (return first):

[PizzaMario.Order_Customer = $Customer]
[OrderNumber = 10]

then use a split to determine if the order != empty and then the rest of you flow


To answer your question:

I would ask what the context of this microflow is, generally speaking. Are you updating customers to VIPs on a scheduled event, only when you click a microflow button, or some other trigger?

One option is to do a nightly scheduled event that promotes customers (you could do real time using event triggers as well).

  1. You could loop through your Customers and see if they are a VIP.
  2. If not, retrieve their 10th order (Entity: Order, Range: First)

    [OrderNumber = 10] [PizzaMario.Order_Customer = $Customer]

  3. If Order != empty, set Customer VIP flag

This is essentially what Erwin has said, I just elaborated a little more so give him credit.

A note on your referenced document:

The guide you have linked is in reference to the XPath query language that Mendix uses. Within the Modeler, you never are writing full XPath expressions. It's because they are created for you!

Mendix takes your XPath constraints and local and global variables along with the domain model to generate an XPath query.

If you do any custom Java work and you need to retrieve data, you have to create the full XPath expression as referenced in your hyperlink.