A function is like an attribute which renders a property or a list of properties of a metadata element. The difference between a function and an attribute is that the function may take parameter(s) whereas the attribute cannot take any parameter(s). MM supports the following functions:
-
ExpandedMembersOfRole('role name')
-
MembersOfRole('role name')
-
Count('Relationship name')
ExpandedMembersOfRole
The ExpandedMembersOfRole function takes one role name parameter and returns the locally assigned and inherited users and groups of a role that an object has including the users of those groups as well. The ExpandedMembersOfRole function can be used along with the following operators as a filter in the WHERE clause: =, !=, = ANY (...), != ANY (...), = ALL(...), != ALL (...), EXISTS and NOT EXISTS.
For example, the Object1 object has the User1 user and Group1 user group assigned locally to the role Role1 that inherits the Group2 assignment. The Group2 group has the User2 user. The following filters would find the object:
-
ExpandedMembersOfRole('Role1') = 'User1'
-
ExpandedMembersOfRole('Role1') = all('User1','Group1','Group2')
-
ExpandedMembersOfRole('Role1') = any('User1','Group1')
-
ExpandedMembersOfRole('Role1') = 'Group2'
-
ExpandedMembersOfRole('Role1') = 'User2'
For any name specified as a value of the filter, the name is treated as a user if there exist a user and a group by the same name. To avoid ambiguity, avoid naming users and groups by the same names.
The ExpandedMembersOfRole function cannot be used in the SELECT list.
MembersOfRole
The MembersOfRole function takes one role name parameter and returns the locally assigned and inherited users and groups of a role that an object has (which are shown in the UI Responsibilities tab). For the example above the membersOfRole('Role1') function returns 3 items for the Object1 object, inherited Group2 user group, locally assigned User1 user, and Group1 user group.
The MembersOfRole function can only appear in the SELECT list.
Count
The Count function takes one relationship name parameter and returns the number of objects of the relationship. The relationship can be a profile relationship or a custom relationship. For example, count('Tables') returns the number of tables of a schema and count('Defines') returns the number of objects a term defines.
The count function can appear in the SELECT list or be used along with the following operators as a filter in the WHERE clause: =, !=, = ANY (...), != ANY (...), <, <=, >, >=, EXISTS and NOT EXISTS.