web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ClearCollect on galler...
Power Apps
Answered

ClearCollect on gallery, only first 5 items are correct

(0) ShareShare
ReportReport
Posted on by 142

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

 

Categories:
I have the same question (0)
  • hnguy71 Profile Picture
    347 on at

    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 Profile Picture
    142 on at

    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 Profile Picture
    347 on at

    Hi @Draax 

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

  • Verified answer
    Draax Profile Picture
    142 on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard