cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Continued Contributor
Continued Contributor

Help with creating collection of users to determine navigation

There are two collections I'd like to create. 1. A collection of reviewers (colReviewers) which will be taken from a people picker column  (DPA) in a SharePoint list (Departments).

2. A collection of users who are named in another SharePoint list (Projects). The users are the author, IAO (people-picker) and IAA (people-picker multi-select).

These will be collected on the OnStart of the app so I can then determine which screen to navigate to.

I already have a formula which sets the 'Claims' of the logged in user (loggedUserClaims).

 

For 1. I used the formula ClearCollect(colReviewers, ForAll(Departments.DPA, DPA.Claims)). However, following on from this, my formula If(loggedUserClaims in colReviewers, Navigate(xxx) has an error 'Can't convert this data type. Power Apps can't convert this Text to a Table. So is there a better way to collect the reviewers?

 

For 2. I cannot find a way to collect the claims of the IAA field - most probably because it's a multi-select people picker. I get the error Invalid argument type. Expecting one of the following: Boolean, Number, Text, OptionSetValue.

How can I get around this?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@calvares 

I'm not sure the reason you want to create collections out of all of this, but if the purpose of the collection is only for this purpose, then I would ditch them and consider the following formula:

If(LookUp(Departments, DPA.Email = User().Email, true), Navigate(xxx))

 

As for the second, it would be the same except you would need to utilize the "in" operator. 

If(LookUp(Projects, User().Email in IAA.Email, true), Navigate(xxx))​

You didn't really describe the conditions for this second part, so I'm not sure where the IAO people come into play, so I tackled the more interesting aspect - the multi-select person column in the above formula.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@calvares 

I'm not sure the reason you want to create collections out of all of this, but if the purpose of the collection is only for this purpose, then I would ditch them and consider the following formula:

If(LookUp(Departments, DPA.Email = User().Email, true), Navigate(xxx))

 

As for the second, it would be the same except you would need to utilize the "in" operator. 

If(LookUp(Projects, User().Email in IAA.Email, true), Navigate(xxx))​

You didn't really describe the conditions for this second part, so I'm not sure where the IAO people come into play, so I tackled the more interesting aspect - the multi-select person column in the above formula.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

calvares
Continued Contributor
Continued Contributor

Thank you @RandyHayes.

For the reviewers, it would be useful to have a collection of them as I can also use it to display/hide certain buttons. Perhaps I also assumed that using lookup or filter would be a problem when the data set becomes too large. Would that be an issue here? 

RandyHayes
Super User III
Super User III

@calvares 

The factor to consider here is that you are only concerned with one person...the current user.  So, why bother with trying to collect all the users and then compare with that?

You can use the formulas I specified for any place that you want to determine button (or other control) visibility, or you can set a snapshot variable of this OnStart of your app.

Set(glbIsInDepartments, LookUp(Departments, DPA.Email = User().Email, true))

 

Then (as in the case of the Navigate) you can use that in your formula:

If(glbIsInDepartments, Navigate(xxx))

 

As well, this can be used on a Visible property:

glbIsInDepartments

this would make the control visible if the user was in that department list.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
calvares
Continued Contributor
Continued Contributor

Thanks @RandyHayes - that's very helpful. I realised I also needed to know the Faculty of the Reviewer from the Departments list so that I can filter a gallery. I've set a variable using a lookup to grab this.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (20,490)