Hi,
I have a gallery where I am trying to display only items where users are reviewers or if the user is the person who raised the item. It appears all the items are visible to all users, and I cannot figure out from my code why, on my items property of my gallery I have:
Sort(
Filter(
List,
(
'Created By'.Email = vUser ||
LineManager.Email = vUser ||
Approver1.Value = vUser ||
Approver12.Email = vUser ||
Approver13.Email = vUser ||
"Email1" = vUser ||
"Email2" = vUser ||
"Email3" = vUser ||
Lower("Email4") = Lower(vUser) ||
vUser = "Email5" ||
CurrentUser.Email in MyMngr.MyUser
)
&&
StartsWith(
YourName.DisplayName,tbSearchInput.Text)
Or StartsWith(RefNumber,Trim(tbSearchInput.Text))
),
ID,
Descending
)
I would expect the above code to display items to only those users who are named in any of the above values or any user in the MyMngr table which I have set at App startup, but all items are visible to all users. regardless of the above.... any ideas?
Thanks
Solved! Go to Solution.
I think if we split this into two separate conditions then we can decisively say whether all users are seeing all items:
If(
//if in MyMngr then only filter by the searchbox
CurrentUser.Email in MyMngr.MyUser,
Sort(
Filter(
List,
(
Len(tbSearchInput.Text)=0 //not filtering if the length of the text in the search textbox is zero
||
(
StartsWith(YourName.DisplayName,tbSearchInput.Text)
||
StartsWith(RefNumber,Trim(tbSearchInput.Text))
)
)
),
ID,
Descending
)
,
//if not in Mymngr, then do normal filter plus searchbox
Sort(
Filter(
List,
(
'Created By'.Email = vUser ||
LineManager.Email = vUser ||
Approver1.Value = vUser ||
Approver12.Email = vUser ||
Approver13.Email = vUser ||
"Email1" = vUser ||
"Email2" = vUser ||
"Email3" = vUser ||
Lower("Email4") = Lower(vUser) ||
vUser = "Email5"
)
&&
(
Len(tbSearchInput.Text)=0 //not filtering if the length of the text in the search textbox is zero
||
(
StartsWith(YourName.DisplayName,tbSearchInput.Text)
||
StartsWith(RefNumber,Trim(tbSearchInput.Text))
)
)
),
ID,
Descending
)
)
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
Hello @iAm_ManCat
Thanks for coming back to me, with what appears to be a working fix to my issue.
As the app was in prod, I needed a quick fix and after messing around for a long time, I decided to scrap the table of users on my App OnStart and just explicitly mention the email adds of the users in the first filter query, which appears to be working (until I realise something else is broken)!
I'm reluctant to give your suggested option a try as if I break it again I could get some very unhappy users. If I find there is another issue, I will give your suggested way a try. I really appreciate you coming back to me on this one.
Just a tip - use Save As to create a copy of the App for testing purposes and share that Test app with just one user who you expect to NOT see all the data, that way you can test on a separate app without having all of the other prod users affected 🙂
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
Thanks @iAm_ManCat
I have been in discussions with product owner to provide a separate environment, but this could potentially be far easier!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
181 | |
52 | |
41 | |
40 | |
34 |
User | Count |
---|---|
262 | |
81 | |
71 | |
69 | |
66 |