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 / Power apps add Gallery...
Power Apps
Answered

Power apps add Gallery to Collections

(0) ShareShare
ReportReport
Posted on by 36

I have a question, I created a button to store my gallery data into collections. 

if i use the button in this code 

Thanapat_Tai_0-1664170558956.png

It will bring the last selected line data into Collections.

Thanapat_Tai_1-1664170876914.png

I want the data in the gallery to import the collections correctly.

 

 

 

 

Categories:
I have the same question (0)
  • ganeshsanap Profile Picture
    1,555 on at

    @Thanapat_Tai This is because you are updating same record in collection again. Try similar to this: 

     

    Collect(Collection2, 
    	ForAll(Gallery1.AllItems,
    		{
    			Spalte1: Besteller.Value,
    			Spalte2: Kostenstelle.Value,
    			Spalte3: Verwendung
    		}
    	)
    )

     

    Try other solutions given on below threads:

    1. https://powerusers.microsoft.com/t5/Building-Power-Apps/Adding-Gallery-Data-to-a-Collection/td-p/56003 

    Please click Accept as solution & 👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it 👍

  • Thanapat_Tai Profile Picture
    36 on at

    @ganeshsanap 
    I have tried it as you said. But the data from the gallery to the collections is still repeated.

    Thanapat_Tai_0-1664178195136.pngThanapat_Tai_1-1664178214245.png

     

  • ganeshsanap Profile Picture
    1,555 on at

    @Thanapat_Tai If you don't want to collect it every time user clicks on button, use ClearCollect() function instead of Collect() like: 

    ClearCollect(Collection2, 
    	ForAll(Gallery1.AllItems,
    		{
    			Spalte1: Besteller.Value,
    			Spalte2: Kostenstelle.Value,
    			Spalte3: Verwendung
    		}
    	)
    )

    Please click Accept as solution & 👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it 👍

  • Thanapat_Tai Profile Picture
    36 on at

    @ganeshsanap 
    I have tried it
    1) In Gallery, lines 1 and line 2 have different values. , like this:

    Thanapat_Tai_0-1664183942277.png

    2) But when I put the value from Gallery and put it in the collection, the data will repeat the value I selected, like this:

    Thanapat_Tai_1-1664184217515.png

     


    Data in Collections i must be
    item 1 Title:10000   field_1:PC2209003  field_2:TEST  field_3:TEST  field_4:2000   field_5:TEST01
    item 2 Title:20000   field_1:PC2209003  field_2:TEST  field_3:TEST  field_4:3000   field_5:TEST03
    Must be as I put in the Gallery.


     

  • Verified answer
    vish3027 Profile Picture
    434 on at

    @Thanapat_Tai 

     

    Please try below formula

     

    ClearCollect(Collection2, 
     ForAll(Gallery1.AllItems, 
     { 
     Spalte1: ThisRecord.columnname, 
     Spalte2: thisrecord.columnname, 
     Spalte3: ThisRecord.columnname 
     } 
     ) 
    )

     

    When you are using ForAll() - You want to refer against each record it getting.

    Putting control names will give you same values from first row.

     

    Thanks

  • Thanapat_Tai Profile Picture
    36 on at

    @vish3027
    I tried
    It can be used. Thank you very much.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard