Intermediate Learning Path; Constrain Your Data Using XPath, 4.7, Help Needed for Rookie

Dear members of the community. Im very new to Mendix. I have the bad habbit of trying to learn everything myself, but now I’m stuck and I need help from somebody that can explain in a calm and easy way!  Currently, Im working on section 4.7 of Intermediate Learning Path ‘Constrain your data using Xpath’, that will be the additional challenges. The learning path itself contains the making of a app that facilitates Vacation Requests and will allow the Administrator to set the approving manager. The challenge is:  Add a reporting page where Administrators can see a list of all Accounts that have never made a vacation request. Everyone who requests a vacation is automatically set to be a ‘Submitter’, so I have to somehow filter known accounts to see if they are known as a ‘Submitter’. I cant lay my hand on the connection between both, because it is not stated as for instance: Account x= Women ( where it should be easy to filter accounts that are women). I have seen other topics where community members are talking about a microflow loop. That being said, i’m not on that level yet that I can figure out what to do here. I know that i should somehow check if there is a connection between the known accounts, and the ‘state’ of submitter, but as stated before, im on a learning path.. If someone can please tell or sugest me what to do, in understandable language, that will be much obliged!!   Thanks in advance!   Stefan.
1 answers

Hi Stefan,


This was harder than expected because you can't check associations for empty, which I didn't expect.

I got it to work, but I do not think it's best practice. Since I changed the ownership of the association to both in the domain model. Otherwise, I wasn't able to check if they had a relationship as submitter. Also I think it's weird to add this exercise while a microflow comes to mind first as to tackle this instead of a XPath.


So to accomplish it I made a page with a microflow as data source. Which looks like this:.

First I retrieve all accounts, then I create a new list to store the filtered objects. In the Loop I check if the relationship as submitter is empty. Like this: $IteratorAccount/VacationManagement.VacationRequest_Submitter=empty

If this is false continue the loop otherwise add it to the list and then continue. In the end-event I pass the new filtered list of accounts to show.


Hopefully I explained everything well enough for you to understand. Also I would like to add that these additional challenges are not at all required to get certified as Intermediate. Also there is a discount offer right now that lets you get certified for free: