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

Filter function displaying duplicate record while filtering powerapps gallery

Hello all powerapps users,

 

I filter my powerapps gallery according that formula, but filter displaying duplicate records.

 

Formula

 

Filter(myboookablecollection,
Resource.name = Dropdown4.Selected.Value,
Text(
Date(
Year(starttime),
Month(starttime),
Day(starttime)
)
) = Label5.Text
)

Duplicates.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft RusselThomas
Microsoft

Re: Filter function displaying duplicate record while filtering powerapps gallery

Hi there,

I agree with Iamlee - there are a variety of possibilities here - "duplicate" in your Gallery might imply you have one record in your source, but it's being served up twice in your Gallery, or it could mean you actually have duplicates in your source.

 

More often than not, when I get duplicates in a gallery, I find I've used Collect() instead of ClearCollect() for my collection. First step would be to make absolutely sure your source does not actually contain duplicates Smiley Happy

 

To see which it is, try using or adding a unique index or ID field on the record to show in the Gallery to see if it's actually exactly the same record, or a different record with the same data.

 

You can also check by collecting your Filter() function in a ClearCollect() function and then going to look at the results in the collection viewer (or just bind them to a data grid to view). You can do this by adding a button and setting it's OnSelect property to;

 

ClearCollect(myFilterResult, 
     Filter(myboookablecollection, 
             Resource.name = Dropdown4.Selected.Value,
            Text(Date(Year(starttime),Month(starttime),Day(starttime))) = Label5.Text 
            ) 
) 
  • If it's returning only one row of data, then we'll have to take a close look at that Gallery.
  • If it's returning two rows, then you have two rows in the source that match the Filter() request - the Gallery is fine and the Filter() is fine, it's the data that has duplicates.
  • If it's returning two different rows but they look the same in the Gallery, check your Gallery data card elements to make sure they're referencing the current row dynamically and not the first result statically.

 

That's all I can think of for now, can you run some tests and come back with more info?

 

Kind regards,

 

RT

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Filter function displaying duplicate record while filtering powerapps gallery

Hi @sachinsoni441 

How are you populating your myboookablecollection collection? Could you somehow be doing this twice, therefore resulting in duplicate records?

sachinsoni441
Level: Powered On

Re: Filter function displaying duplicate record while filtering powerapps gallery

Hello @timl ,

 

On first screen i store my dynamics entity in collection and use this collection variable in filtererror.jpg

 

Highlighted
iamlee
Level 8

Re: Filter function displaying duplicate record while filtering powerapps gallery

If you display your collection, what do you see? Is it also double entry? It could be the display is correct as there are 2 valid items meeting your selection criteria. If there's only 1 entry in your collection, try ClearCollect.

Microsoft RusselThomas
Microsoft

Re: Filter function displaying duplicate record while filtering powerapps gallery

Hi there,

I agree with Iamlee - there are a variety of possibilities here - "duplicate" in your Gallery might imply you have one record in your source, but it's being served up twice in your Gallery, or it could mean you actually have duplicates in your source.

 

More often than not, when I get duplicates in a gallery, I find I've used Collect() instead of ClearCollect() for my collection. First step would be to make absolutely sure your source does not actually contain duplicates Smiley Happy

 

To see which it is, try using or adding a unique index or ID field on the record to show in the Gallery to see if it's actually exactly the same record, or a different record with the same data.

 

You can also check by collecting your Filter() function in a ClearCollect() function and then going to look at the results in the collection viewer (or just bind them to a data grid to view). You can do this by adding a button and setting it's OnSelect property to;

 

ClearCollect(myFilterResult, 
     Filter(myboookablecollection, 
             Resource.name = Dropdown4.Selected.Value,
            Text(Date(Year(starttime),Month(starttime),Day(starttime))) = Label5.Text 
            ) 
) 
  • If it's returning only one row of data, then we'll have to take a close look at that Gallery.
  • If it's returning two rows, then you have two rows in the source that match the Filter() request - the Gallery is fine and the Filter() is fine, it's the data that has duplicates.
  • If it's returning two different rows but they look the same in the Gallery, check your Gallery data card elements to make sure they're referencing the current row dynamically and not the first result statically.

 

That's all I can think of for now, can you run some tests and come back with more info?

 

Kind regards,

 

RT

View solution in original post

james_hathaway
Level: Powered On

Re: Filter function displaying duplicate record while filtering powerapps gallery

I am experiencing the same issue...

 

When I use a form to add a new record to a SharePoint Dataset - the record is then shown twice in the Gallery - but interestingly, only when the gallery is showing a Filtered list of records in the datasource - if I remove the filter and have the gallery look at all records in the datasource, there is only one instance of my new record.

 

I have also double checked the sharepoint list in question (the datasource), and there is definitely only one instance of the newly created record - it is just that the gallery is showing that record twice.

I have also noticed that the duplicate record is only being shown to the User that created the new record - a second user looking at the app only sees one instance of the newly created record. Also, for the user that created the record, closing and reopening the app solves the issue - the duplicate gallery entry is gone.

 

So if I have ruled out the fact that the datasource contains 2 records, and the duplicate is only showing on the app for the user that created the record, it must be some sort of bug in PowerApps itself....?

 

Does anyone know why a Gallery would be showing a newly created record twice?

 

FYI:

Gallery Items formula:

     Filter(Datasource, 'Created By'.DisplayName=User().FullName)

Gallery "Default" formula:

     Gallery_DefaultSel

 

Form "Save Button" Forumla:

If( Datasource_Form.Mode = FormMode.New, 

      SubmitForm(Datasource_Form); Set( selectedRecordID, Datasource_Form.LastSubmit.ID),

               // (My form is decoupled from the gallery - I use this global variable to tell the form which record to look at)

      SubmitForm(Datasource_Form); UpdateContext({Gallery_DefaultSel: Datasource_Gallery.Selected}); 

           ResetForm(Datasource_Form);
)

 

James.

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,777)