1
votes

I'm having an issue with a global Variable in MS PowerApps. I built an App and now want to have two groups of people. Admins(who can do everything) and normal Users(who can read every post and edit theire own ones but not everything of it). Therefor I made up a Sharepoint list(cause the posts are stored in a Sharepoint list aswell) to save the users name that are Admins. All other users are standard users.

Set( Admin,If( IsEmpty( Filter( 'Prototype App Admin',Username=User().FullName ) ), false, true ) );

OnStart of the App I initialize the variable Admin on true if the Users name is included in the list(it does not give me any error here).

If( User().FullName=ThisItem.'Author', true, false ) || If( Admin=true, true, false )

(I put in this code in the visibility field of my gallery where the posts are shown of) Now I check if the User, who is using the App right know is the author of the post or if it is an admin who is watching.

The column Author includes the FullName of the Author. PowerApps gives me a "Name isn't valid" back but I also have imported the Sharpoint list. I don't get any Error massage on the Admin-function but I also can't see the posts.

Can you tell me what I'm doing wrong?

1
Hello, welcome to StackOverflow! In which property (and for which control) do you get the "Name isn't valid" error?carlosfigueira
Sry the error is at ThisItem.Author Btw I fixed the Admin Bug by reloading the App but the "Name isn't valid" error is still there for ThisItem.AuthorSoam.P

1 Answers

2
votes

If someone has the same issue, I've solved mine. You just have to work in the "Items" field of your gallery and combine the two tasks within a SortByColumns statement.

SortByColumns( Filter( 'Prototype App',If( Admin=true,true,User().FullName=Author ) ),"Author" )