Retrieve forms of specific users

Hi, I am trying to retrieve the forms of specific users from the database, I am using this Xpath: [Studentnummer = MyFirstModule.Student_Forms/MyFirstModule.Student/System.owner/System.User/Name] The student has to login first, after that I want to retrieve the forms which contain the login name the student has used to login. I am completely new to Mendix so don't judge :/
2 answers

You can’t check for a user in a dataview (as far as I know). What I would do is use a microflow as data source for the dataview instead of database or XPath. Create a microflow like this (Picture 1), retrieve the current user with the $currentUser variable (Picture 2) and then take that return value to retrieve the form which has that name on it.


Picture 1:


Picture 2:


Then use the return value of that retrieve action (which holds the logged in user) and retrieve the forms from database with this XPath (use range ‘all’ here not ‘first’):

Mine has an error because I don’t have a Studentnummer attribute.


At the end you should have a list of objects left. You can set the return value of the end event to that list of entitiy forms (or what your forms entity is called) and use the retrieved forms list as the return value.


Hi Meindert


If I understand you correctly you want to retrieve the forms of the logged in user, right? You can retrieve the name of the logged in user by using “$currentUser/Name’ which holds the username of the logged in user. Then just retrieve the form in which ‘[Studentnummer = $currentUser/Name]’.

Are you sure though the Studentnummer holds a name and not a number?