Filter results on match zipp-code logged on user with zipp-code of record

Hi Everyone, I'm very new to Mendix and still experimenting with the platform. I've recently build an app in witch users can exchange goods. On the overview page in the app all offered goods are shown. That works well. Only thing I don't manage to do is filter those offered goods on zipp-code. I mean, I do know how to filter them on a given zipp-code. But I don't know how to filter them on the zipp-code of the logged on user in order to only see local offerings. The zipp-code of the logged on user is stored in administration.account and should be compared to the zipp-code that is saved in the offering (the zipp-code of the person that offers the goods). Subsequenty, only the offerings that matches the zipp-code of the user should be returned. I think this is not possible by using an Xpath in the dataview itself. I probably need a microflow that returns an new filtered list. Would you please be so kind to explain everything on beginner level and in small steps so I can follow? Thank you all very much in advance :)!
1 answers

Hi Josephine,

From what I understand you have a seperate entity "Good" which is associated to an "Offer" which is associated to an account entity of the person who offers it or in the offer the ZIP code is saved of the person who offers it. Either way In the grid on the overview you could choose for a microflow as datasource and then first retrieve your current acocunt by the xpath:


By options choose "First" and by output I've chosen the name "CurrentAccount"

Then retrieve your offered goods by an xpath as follows when storing the zipcode of the person who offers it in the offer entity:

[MyFirstModule.Offer_OfferedGood/MyFirstModule.Offer/ZIPcode = $CurrentAccount/ZipCode]

or when you choose to connect the offer to the account of the person who offers it:

[MyFirstModule.Offer_OfferedGood/MyFirstModule.Offer/MyFirstModule.Offer_Account/Administration.Account/ZipCode = $CurrentAccount/ZipCode]

Here a modelshare of what such a microflow could look like: