In reply to: Przemysław Wrzesiński
Hi Daniel, thank for quick response. Unfortunately I still have a problem with SQL filter. How to combine the condition Project/Department field value is equal to one of the elements of the collection of the AD groups (user can be a member of more than one AD group) from (as I understand) dbo.CacheOrganizationStructure table, [COS_AD_memberOf] column - the user belongs to.
Przemek
Hi Przemek,
you can use the below filter, at least if the ID of your department field equals the BpsID. Otherwise you need to check the values.
The filter condition will get the BpsId of all groups of which the currentuser is a member and than it will be checked, whether the Id of the Department, WFD_AttChoose5) in my case, is an element of this collection.
Remark: Don't get rid of the rtrim, a space will be added to any used variable. This doesn't hurt with column names, but if the variable is used in a string it makes a different whether you search for AttText1 = 'my value'
or AttText1 = 'my value '
The rtrim will remove the trailing space.
This is just one of those issues, if you don't fix it in the beginning, it won't get fixed. On the other hand, we may have chances with BPS 2023. :)
Best regards,
Daniel
and (dbo.ClearWFElemId(WFD_AttChoose5 ) in
(
SELECT groups.COS_BpsID /*, groups.COS_DisplayName, groups.COS_AccountType, groups.COS_GroupType, groups.COS_ProviderType*/
FROM
[CacheOrganizationStructure] as groups
join [CacheOrganizationStructureGroupRelations] groupRelations on
groups.COS_ID = groupRelations.COSGR_GroupID
join [CacheOrganizationStructure] as users on
users.COS_ID = groupRelations.COSGR_UserID
and users.COS_BpsID = rtrim('##currentloginname## ')
)
)