Constrain (Order) data with two different lists (Buyer, Trading Partner) from same Company pool

Hi Mendix community, I am working on a use case were a larger pool of Companies (Entity1) can buy various product via Purchase Orders (Entity 2) from other companies from the same pool of companies. A Company can only buy from another Company if they have accepted the Company as eligible TradingPartner (Entity 3). I want to display a Data Grid with Purchase Orders from all eligible Trading Partners of the Company who is using the system (%CurrentUser%). The microflow below does only return the Orders from the first eligible TradingPartner and not from all TradingPartners. When using XPath constrains as DataSource no Orders are displayed at all. I assume it is the fact that I need constrain the data not by an individual company (hence Buyer = equals does not work) but to a list of companies. So comparing a list of Orders from Companies with a list of TradingPartners from the same Company pool. Any ides of who to approach this issue are welcome. Thank you. Rex    
2 answers

It looks like (without having seen the domain model) you are self-referencing the TradingConditions entity (TradingConditions = Company ?). From you description I would assume it is set as a many-1 relationship. I believe the default owner of such a relationship is the Child (Eligible TradingPartner); whereas in this case you would want the Parent (Company) to be the owner, since you are retrieving from that entity.

It would help to get a look at the domain model and also if the enities in your description actually are named the same as the enitities in your microflow, haha.


Hi Ruben, thanks for taking your time to help. Much appreciated.

Please find attached a schematic of the relevant parts of the domain model and a slightly amended microflow.

What I am trying to achieve is filter an object list (Buyer) with another object list (TradingPartner). When I retrieve the TradingPartner Object with ‘Range: All’ I cannot use the List Operation ‘Filter’, only when I retrieve with Range: First, but that will return only the first TradingPartner Object. Are there other ways to achieve this. I come across another forum entry with a similar and there was reference to ListUtils from the Marketplace, but this seems to be discontinued.

Any ideas how to structure the Micoflow with a loop over the trading partner list? Or different structure to the Domain model for XPath constraints?

Any help is welcome. Thank you