Hi all,
I have an aggregate which i wish to filter user with role "Role1" and does not have "Role2" and "Role3"
I try with != operator but it return "Expecting an expression instead of end of line. " error
I try with <> operator but it return me users with "Role1" or "Role2" or "Role3"
Does anyone know how to filter? Help!!
Hi Johnson Lim,
You can't accomplish that with a filter condition, you will need to work on your join conditions together with filter conditions.
for each role involved, you need to join user with user_effective_role, with as join condition what role exactly you are interested in (i would work with role id, not label)
so in your case, 3 roles = 3 joins.
Then, for each joined role, in your filter you say whether you want that role to exist or not to exist.
For example, if you are interested in users with role 1 that don't have role 3 :
Dorine
Hi Johnson,
Like everywhere else in OutSystems, and like in SQL, "!=" is not the unequal operator, "<>" is. Please make sure you have the basics of OutSystems down before trying to do more elborate things!
Also, it seems to me you do not understand how query's (aggregates) work. A filter like:
Role.Name="Role1" and Role.Name <> "Role2" and Role.Name <> "Role3"
Doesn't make sense, as in case Role.Name equals "Role1", it automatically follows that it is not equal to "Role2" and "Role3". How could the database select a row that has Role.Name both "Role1" and "Role2"??
If you look at the data model, for each role there's a seperate record in the database, so you will need to do what Dorine suggested, viz. join the role table more than once, using an inner join ("Only With") on Role1 and a left join ("With or Without") on Role2, and then make sure that Role2 isn't actually found.
yes, Kilian,
that's better,
I'm a sucker for symmetry, so I guess that's why I had both as with or without, and then a = and a <> filter...
but it should of course be only with Role1, and then that filter on Role1 <> NullIdentifier can go