cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Re: Filter a gallery by current user with a toggle

Are you sure you are using the correct names for your SharePoint list and created by field? The data source name in the filter should be green if it is a valid data source which leads me to believe the name isn't correct.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
Helper II
Helper II

Re: Filter a gallery by current user with a toggle

Sorry Jeff - you are correct, I had the SP List as 'Engagement List' instead of the correct 'Engagement Form'.  That being said, it still isn't working.  When Toggle1 is checked, all items disappear from the list.  Please refer to the attached screenshot.  That being said, I do like how you are setting a global variable in order to prevent delegation warnings.

 

-Jake

Highlighted
Super User
Super User

Re: Filter a gallery by current user with a toggle

Where did you set the gvCurrentUser variable? If you set it in the OnStart of the app and you haven't closed and reopened the app you will need to click on the ellipse next to the App control and select Run OnStart.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
Helper II
Helper II

Re: Filter a gallery by current user with a toggle

That was it, thanks Jeff - I didn't realize that was necessary.

 

I apologize in advance, but if you think you could nest your gallery items formula with the default one, it would help me understand the nesting syntax a bit better?

 

If(Toggle1.Value, Filter('Engagement Form', 'Created By'.DisplayName = gvCurrentUserName), 'Engagement Form')

 

SortByColumns(Filter('Engagement Form', StartsWith(Activity_Name, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

-Jake

 

 

Highlighted
Super User
Super User

Re: Filter a gallery by current user with a toggle

Hi @JRuss 

If I understand you correctly, you can just do this....

 

SortByColumns(If(Toggle1.Value, 
Filter('Engagement Form', 'Created By'.DisplayName = gvCurrentUserName),
'Engagement Form'
),
"Title",
If(SortDescending1, Descending, Ascending)
)

 

Highlighted
Helper II
Helper II

Re: Filter a gallery by current user with a toggle

Hi timl,

 

It seems that you dropped the below portion of the formula.  It appears to be needed for the search box to work.

 

StartsWith(Activity_Name, TextSearchBox1.Text)

 

-Jake

Highlighted
Helper II
Helper II

Re: Filter a gallery by current user with a toggle

Hi Reza,


This is working! Thank you so much 🙂

 

-Jake

 

I'm probably going with Jeff's solution however, as I like that the use of the global variable prevents delegation warnings.  Still looking to nest that with the default Gallery.Items formula (while maintaing search functionality), if anybody knows?

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,367)