Skip to main content

Notifications

Community site session details

Community site session details

Session Id : AH6xq5ZGx6C17asCvHL1ja
Power Apps - Building Power Apps
Answered

ForAll Gallery.AllItems Collect values from gallery returns same value for items if you use As

Like (0) ShareShare
ReportReport
Posted on 21 Jan 2023 13:42:33 by 293

I have a gallery with an text input box and I was trying to use the following power fx:

 

 

 

Clear(myCollection);
ForAll(
myGallery.AllItems As item, 
 Collect(myCollection, {value : textinput1.text})
)

 

 

 

The result of this is that all values returned to myCollection are the same value, that of the first item.

 

 

  • KASCHN Profile Picture
    293 on 21 Jan 2023 at 14:27:00
    Re: ForAll Gallery.AllItems Collect values from gallery returns same value for items if you use As

    @SagarVIS96 Good catch. I knew it had something to do with the As item! thank you

  • Verified answer
    SagarVIS96 Profile Picture
    212 on 21 Jan 2023 at 13:54:39
    Re: ForAll Gallery.AllItems Collect values from gallery returns same value for items if you use As

    Hi @KASCHN ,

     

    You can use the following code:

    Clear(myCollection);
    ForAll(
    myGallery.AllItems As item, 
     Collect(myCollection, {value : item.textinput1.text}
    )

     

    Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started