cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Draax
Level 8

ClearCollect on gallery, only first 5 items are correct

Hi,

 

 

I have a gallery on my mainscreen with 100 diffrent items.

Inside the gallery i have a textbox with the following code: 

Value(CountRows(Filter(Lager, 'Title (Title0)'.Value=ThisItem.Title,Reserverad.Value = "Nej", Sparad.Value <> "Ja")))

(Checks how many items is there in stock per item)

 

Next screen I have a datatable where I collect an inventory report.

 

OnSelect for getting the data for the datatable are:

ClearCollect(Report, AddColumns(Gallery_Main_Artiklar.AllItems, "Antal", Label_Current_Stock.Text))

The first 5 items in the report (textbox) are correct.

The next 95 items will get the same value as item 5.

 

Workaround, scroll through the items gallery all the way to the end and the report will be correct.

 

Is there a way to permanently fix this without the given workaround?

 

Thanks - Johan

 

1 ACCEPTED SOLUTION

Accepted Solutions
Draax
Level 8

Re: ClearCollect on gallery, only first 5 items are correct

I woundn't mind at all. However it seems like i found some sort of workaround.

 

If i press the button again to clearcollect, it will get the correct values.

To build the work around i put a timer, clearcollect on start - delay 4 sec - clearcollect on finish.

Report now show correct values.

 

Thanks for you help 🙂

 

Draax

View solution in original post

4 REPLIES 4
Highlighted
hnguy71
Level 8

Re: ClearCollect on gallery, only first 5 items are correct

Hi @Draax ,
If i'm understanding this correctly, you want the count of items that matches your Title. Instead of the countrows function you should instead do a countif inside your label:

CountIf(Lager, Title = ThisItem.Title && Reserverad = "Nej" && Sparad <> "Ja")

datatable.png

 

 

Draax
Level 8

Re: ClearCollect on gallery, only first 5 items are correct

Hi @hnguy71 ,

 

Thanks for your reply!

 

Unfortunately i'm experiencing the same issue with the new code. Im attatching images to clarify.

 

This is the report

flux.png

 

 

 

This is my gallery with diffrent items for sale

flux2.png

 

If I scroll all the way to the bottom of the gallery the report will be correct.

I think it has to do with PowerApps only executing the textbox once it has been viewed.

 

Draax

hnguy71
Level 8

Re: ClearCollect on gallery, only first 5 items are correct

Hi @Draax 

Do you mind sharing me your sample data? I would like to see if I can reproduce your issue

Draax
Level 8

Re: ClearCollect on gallery, only first 5 items are correct

I woundn't mind at all. However it seems like i found some sort of workaround.

 

If i press the button again to clearcollect, it will get the correct values.

To build the work around i put a timer, clearcollect on start - delay 4 sec - clearcollect on finish.

Report now show correct values.

 

Thanks for you help 🙂

 

Draax

View solution in original post

Helpful resources

Announcements
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 (Last 30 Days)
Users online (5,756)