String Field Equal To Logged In User

0
Hi, I have a string field saved with the CurrentUser name (this string field is UserID in the XPath syntax further down). I’m trying to create an xpath criteria that says that string field must equal the user name of the logged in user. I’m getting empty results using the following. This table is NOT joined to any tables in my domain model since it is a reporting table and comes from an external source (long story). Is there a way for me to filter for only the logged in user’s data? The Xpath I tried to use is: [UserID = '[%CurrentUser%].Name'] Again, UserID is just a string field containing the user’s name fed in from another source (hence a standalone reporting table). I want to filter against this string field for the logged in user.  Thanks for any tips.
asked
3 answers
3

Stella is right. '[%CurrentUser%]’ is only a token that represents the internal id of the current user. You can use it to identify the object in the database, but you can’t directly access attributes of it.

answered
2

Hi, 

Create a string variable which holds a current user name and then use that variable in your XPath to filter like below.

Here Name is the variable name which holds current user name.

[UserID = $Name]

answered
2

You say that it is NOT joined to any tables in your domain model.

But if you are processing data in Mendix it ALWAYS is plotted on entities. Either persistable or non-persistable. So Mendix syntax is always needed. Thus your XPath uses a syntax which doesn’t work by any means. At first you need to use the CurrentUser variable and then navigate to the Name value using a ‘/’

[UserID = $CurrentUser/Name]

Secondly, you mention that your information is not stored in a table, thus XPath will never work, since XPath will lead to a database SQL query. and thus will not find anything because its not in your database.

No idea where your data is comming from and how it is processed, but you need to do some filtering etc in microflows

answered