cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tamer66
Level: Powered On

Filter own groups with select on SQL Views

Hello,

 

I need a little support on the subject of groups and show/Filter galleries.

 

With this code i can check my ownedGroup if that i am a member and filter the right data.

This works fine in Gallery Items and it is ok.

 

If(
    "Group1" in 'Office365-Gruppen'.ListOwnedGroups().value.displayName;
    Filter(
        '[dbo].[SQL_view]';
        ArtName = "contracts_for_group1"
    )
)

But i have 5 Groups and i want to check more than 1 group, i try this code.

 

If(
    "Group1" in 'Office365-Gruppen'.ListOwnedGroups().value.displayName;
    Filter(
        '[dbo].[SQL_view]';
        ArtName = "contracts_for_group1"
    );
    "Group2" in 'Office365-Gruppen'.ListOwnedGroups().value.displayName;
    Filter(
        '[dbo].[SQL_view]';
        ArtName = "Group2"
    )
)

I get no errors but the return ist only from Group1 and nothing from group2.

 

Has anyone an idea how can i check more Groups as 1 with correct Filter syntax.

 

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Tamer66
Level: Powered On

Re: Filter own groups with select on SQL Views

Hi,

 

i solved the problem.

 

1. collect the data in a collection

If(
    Connection.Connected;
    ClearCollect(
        myGroups;
        'Office365-Gruppen'.ListOwnedGroups().value.displayName
    )

and filter the data 

 

Filter(myGroups; ArtName in myGroups.displayName)

 

Thanks a lot

7 REPLIES 7
Eloy
Level: Powered On

Re: Filter own groups with select on SQL Views

can a person be in more than 2 groups?

for example can you be part of Group1 and Group2  or you can only be in one Group?

 

 

Tamer66
Level: Powered On

Re: Filter own groups with select on SQL Views

Hi,

a person can e.g. in group1 and in group3 and in group5.

or

only in one group

Eloy
Level: Powered On

Re: Filter own groups with select on SQL Views

Ok, so based on what you wrote here is the what i understand:

1) You have multiple SQL views based on group contracts.

2) What you want is a collection of all the contracts for a person based on their group membership. So for example if Joe belongs to group1 and group2, you want to get the data from 2 different SQL Views, view1 that has all of the contracts for Group1, and View2 which has all of the data for Group2.

 

is this correct?

Tamer66
Level: Powered On

Re: Filter own groups with select on SQL Views

Hi Eloy,

 

this is correct but the only different is i get the data from one SQL View.

After check my group membership i filter the data from one SQL View

 

 

Eloy
Level: Powered On

Re: Filter own groups with select on SQL Views

Well, I am hoping the Filter allows you to filter using th IN operator, I don't know for sure

 

 

Filter('dbo.view', Artmen in 'Office365-Gruppen'.ListOwnedGroups() )

I am expecting for 

'Office365-Gruppen'.ListOwnedGroups()

to return a table of the groups the user belongs to ['Group1','Group2','group3']  . 

Let me know if the 2 assumptions are correct, use IN in Filter Statement and ListOwnedGroups() returns a table.

Tamer66
Level: Powered On

Re: Filter own groups with select on SQL Views

Eloy,

 

the 

'Office365-Gruppen'.ListOwnedGroups()

gives me the groups but Filter with IN gives me no returns 

Highlighted
Tamer66
Level: Powered On

Re: Filter own groups with select on SQL Views

Hi,

 

i solved the problem.

 

1. collect the data in a collection

If(
    Connection.Connected;
    ClearCollect(
        myGroups;
        'Office365-Gruppen'.ListOwnedGroups().value.displayName
    )

and filter the data 

 

Filter(myGroups; ArtName in myGroups.displayName)

 

Thanks a lot

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 18 members 4,254 guests
Please welcome our newest community members: