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

Re: Trying to filter by field on a gallery

Hi @yashag2255 ,

 

Unfortunately after changing the formula it still shows no items in the gallery still, on second press it successfully reverts to all galleries however.

 

Any ideas?

 

Kind Regards

 

Andrew

Dual Super User
Dual Super User

Re: Trying to filter by field on a gallery

Hi @AChapman 

 

That's really strange! Can you please confirm if this Status field is of type text?
 
Also, can you carry out a little test so that we can debug the formula correctly. Create a temporary button and put the below expression on the OnSelect property:
 
ClearCollect(TestCollection,Filter(Table2,"Current_x0020_Process"="Completed"))
 
Now, play the app and click this button, now exit play mode, Navigate to View and select collection. Can you confirm if you are getting any data in this collection. If data exists, we need to make changes to Gallery Items formula, else we need to correct the expression so that it returns data to this collection.
 
Once this operation is done, remove the button from your app.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
AChapman
Level: Powered On

Re: Trying to filter by field on a gallery

Hi @yashag2255 ,

 

I should have said that the "Current Process" field is a dropdown box on a different screen, not sure if that changed anything.

 

I have attached a screen shot of the dropdown screen on a different screen.

 

Will work on the second test now.

 

Kind Regards

Dual Super User
Dual Super User

Re: Trying to filter by field on a gallery

Hi @AChapman 

 

es this will definitely make a difference since the edit form reference need to be passed. I am guessing that the Item property of your Edit Form is pointing to the gallery in the Browse Screen. If you have a use case where you need to set this value on an edit form and refresh the data in browse gallery, then you need to create a variable beacuse as soon as the reference changes to the edit form, this dropdown value will also change.
 
Set a variable on the "OnChange" property of your Dropdown in Edit Form as:
 
Set(SelectedStatus, DataCardValue13.Selected.Value)
 
Now use this "SelectedStatus" variable instead of the "Completed" status as:
 
SortByColumns(If(IsBlank(TextSearchBox1.Text),If(FilterCompleted,Filter(Table2,"Current_x0020_Process"=SelectedStatus),Table2),Search(If(FilterCompleted,Filter(Table2,"Current_x0020_Process"=SelectedStatus),Table2),TextSearchBox1.Text,"Current_x0020_Process","Date","ID_x0020_No")),"Current_x0020_Process",If(SortDescending1,Descending,Ascending))
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
AChapman
Level: Powered On

Re: Trying to filter by field on a gallery

@yashag2255 

 

EditScreen1

EditForm1 Item is:

BrowseGallery1.Selected

 

Dropdown box DataCardValue13 OnChange is:

Set(SelectedStatus, DataCardValue13.Selected.Value)

 

BrowseScreen1

BrowseGallery1 item is:

SortByColumns(If(IsBlank(TextSearchBox1.Text),If(FilterCompleted,Filter(Table2,"Current_x0020_Process"=SelectedStatus),Table2),Search(If(FilterCompleted,Filter(Table2,"Current_x0020_Process"=SelectedStatus),Table2),TextSearchBox1.Text,"Current_x0020_Process","Date","ID_x0020_No")),"Current_x0020_Process",If(SortDescending1,Descending,Ascending))

 

IconFilter1 OnSelect is:

Set(FilterCompleted,!FilterCompleted)

 

Not sure what else to suggest / next steps here????

 

 

 

AChapman
Level: Powered On

Re: Trying to filter by field on a gallery

I don't actually need the Search Items box if I have the filter to filter out "Completed".

 

So if that is complicating the formulas then I can remove.

AChapman
Level: Powered On

Re: Trying to filter by field on a gallery

@yashag2255 

 

any updates?

Dual Super User
Dual Super User

Re: Trying to filter by field on a gallery

Hey @AChapman 

 

I think the problem here is with the way you are selecting the Status value. There is a circular reference that is getting created here, with this the edit form points to gallery selected item and when either the gallery items are changed or another item in the gallery is selected, this will trigger the OnChange property of the combobox in edit form and hence a new value other than completed is set. 
 
Is there a way you can set this value by some other mechanism? Maybe not onchange property of that combobox, but a different button which does this only when it is pressed. This way the value will be set only when user want to change the selected status. 
 
I don't think search will make any change in this implementation, but if you do not need it, the formulas can be modified to:
 
EditScreen1

EditForm1 Item is -> BrowseGallery1.Selected
Additional Button to Set Status -> OnSelect -> Set(SelectedStatus, DataCardValue13.Selected.Value)

BrowseScreen1
BrowseGallery1 -> Items -> SortByColumns(If(FilterCompleted,Filter(Table2,"Current_x0020_Process"=SelectedStatus),Table2),"Current_x0020_Process",If(SortDescending1,Descending,Ascending))

IconFilter1 -> OnSelect -> Set(FilterCompleted,!FilterCompleted)
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
AChapman
Level: Powered On

Re: Trying to filter by field on a gallery

@yashag2255 

 

Thanks for reply,

 

Will it work if I keep the drop down but add another function to the IconAccept1 to set the selected status of the drop down?

 

something like Set(SelectedStatus, DataCardValue13.Selected.Value)&SubmitForm(EditForm1)

?

 

Or is the issue that it changes when I move back to the gallery?

 

AChapman
Level: Powered On

Re: Trying to filter by field on a gallery

@yashag2255 

 

I need the users to select from a determined list, is there any other way to do this other than a dropdown?

 

I have tried the above method I mentioned and still seem to be getting nowhere.

 

I have attached updated screenshots with all information I believe is relevant.

 

Again, many thanks for all your help.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,271)