cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Gallery Bug - Filtered gallery resets itself

I have a gallery reading filtered data and after I patch the records sucessfuly through a button on select function, the gallery resets itselft and displays data from record 1 and no longer the filtered data.

 

This is the code I am using under the items property of the gallery:-

 

Search(SortByColumns(Filter(Database,'Submitted By'= User().Email),"Created",Descending),SearchInputField_2.Text,"Title")

 

If I take out the filter it does not reset itself after a patch? definately something to do with the filter being applied...

 

14 REPLIES 14
Highlighted
Super User III
Super User III

Re: Gallery Bug - Filtered gallery resets itself

Hi @GordonMcCulloch ,

The first thing you might look at is the non-delegable filter User().Email. This is easily fixed by setting a Global Variable at App OnStart

Set(UserMail,User().Email)

then try

Search(
   SortByColumns(
      Filter(
         Database,
         'Submitted By'= UserMail
      ),
      "Created",
      Descending
   ),
   SearchInputField_2.Text,
   "Title"
)

I am not sure this is the issue, but it certainly cannot be helping, Please let me know.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Frequent Visitor

Re: Gallery Bug - Filtered gallery resets itself

Hello @WarrenBelz ,

 

Thank you for the suggestion.

 

I have put in the place the change you suggested but no luck unfortunately. The gallery still resets itself after press the button that runs the Patch.

 

I could maybe change my Patch to a Form style submission? Maybe that would help would help? Its a pretty complicated patch though so not sure if its even possible:-

 

 

Set(
    CurrentComments,
    (ThisItem.'Further Information')
);
Set(
    NewComments,
    AddInfo_1.Text
);
If(
    IsBlank(ThisItem.'Further Information'),
    Set(
        PatchComments,
        Concatenate(
            Text(
                Now(),
                "[$-en-GB]dd/mm/yyyy hh:mm:ss"
            ),
            " (UTC): ",
            Char(10),
            NewComments
        )
    );
    Patch(
        Database,
        {ID: ThisItem.ID},
        {'Further Information': PatchComments}
    ),
    Set(
        PatchComments,
        Concatenate(
            CurrentComments,
            Char(10),
            Char(13),
            Text(
                Now(),
                "[$-en-GB]dd/mm/yyyy hh:mm:ss"
            ),
            " (UTC): ",
            Char(10),
            NewComments
        )
    );
    Patch(
        Database,
        {ID: ThisItem.ID},
        {'Further Information': PatchComments}
    )
);
Refresh(Database)

 

 

Highlighted
Frequent Visitor

Re: Gallery Bug - Filtered gallery resets itself

Just created a form item and the gallery seems to reset when a form is submitted as well.

Highlighted
Super User III
Super User III

Re: Gallery Bug - Filtered gallery resets itself

OK @GordonMcCulloch
Is 'Submitted By' a text field in the data source?
As a bit of an elimination exercise, try getting rid of the Search function and see if it till resets.
Also, SortByColumns here is not doing anything Sort cannot do, so you might try

Search(
   Sort(
      Filter(
         Database,
         'Submitted By'= User().Email
      ),
      Created,
      Descending
   ),
   SearchInputField_2.Text,
   "Title"
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Frequent Visitor

Re: Gallery Bug - Filtered gallery resets itself

Thanks again for the help @WarrenBelz 

 

I stripped back the code as suggested.

 

I am basically left with the below, and the issue still occurs:-

 

 

 

Filter(
    Database,
    'Submitted By' = UserMail
)

 

 

 

'Submitted by' reprisents an entry column in a share point list called 'Database'

 

I'm starting to think this is maybe something to do with my sharepoint or apps settings?

Highlighted
Super User III
Super User III

Re: Gallery Bug - Filtered gallery resets itself

Thansk @GordonMcCulloch ,

I get to see some strange ones, this is up with them.

I assume 'Submitted by' is a plain text field in SharePoint?

Highlighted
Frequent Visitor

Re: Gallery Bug - Filtered gallery resets itself

Thanks @WarrenBelz . Yes it is a single line of text plain text field on the sharepoint list for that column.

 

I have tried recreating the gallery and input fields. Still same issue. 

 

Highlighted
Super User III
Super User III

Re: Gallery Bug - Filtered gallery resets itself

Ok  @GordonMcCulloch - I will call in my code guru colleague (and fellow Ozzie)  @Eelman to give it a go - I am out of ideas.

Highlighted
Super User II
Super User II

Re: Gallery Bug - Filtered gallery resets itself

@WarrenBelz  thanks for the tag, this is an odd one.

 

@GordonMcCulloch  Try setting the Default of SearchInputField_2 to "" ( ie blank ) then add this to the end of your Patch code

 

Reset( SearchInputField_2 )

 

Also, as you are the user related to UserEmail have you added more than one record to Database? Silly question I know but just checking 🙂 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,809)