Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to keep the first item in the collection?

(0) ShareShare
ReportReport
Posted on by 492
I have a gallery with repeating rows, and I want to keep the first row when users delete other rows.
 
add button on select syntax : 
// Add a new row
Collect(Col_AccessForm, {
    'Source System Name': TextInput2.Text,
    'Source IP-Address': TextInput2_2.Text,
    'Destination System Name': TextInput2_3.Text,
    'Destination IP-Address': TextInput2_4.Text,
    'Destination Port/s': TextInput2_5.Text,
    'VPN/Lease': TextInput2_6.Text
});
 
// Debugging: Display the contents of Col_AccessForm
Label1.Text = First(Col_AccessForm).'Source System Name';
Label2.Text = First(Col_AccessForm).'Source IP-Address';
Label3.Text = First(Col_AccessForm).'Destination System Name';
Label4.Text = First(Col_AccessForm).'Destination IP-Address';
Label5.Text = First(Col_AccessForm).'Destination Port/s';
Label6.Text = First(Col_AccessForm).'VPN/Lease';
 
Gallery Item syntax: Col_AccessForm
 
The trash can icon OnSelect: Remove(Col_AccessForm, LastN(Col_AccessForm,1)
 
 
How can I achieve this?
 
  • Verified answer
    NN-21081740-0 Profile Picture
    492 on at
    How to keep the first item in the collection?
    I managed to come up with the solution:
     
    I thought of disabling the trash can icon when there's only one row left and BOOM!
     
    So in the Display Mode properties of the trash can I added :
     
    If(CountRows(Col_NetworkForm)=1, DisplayMode.Disabled)
     
    💃💃💃💃

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1