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 / Loop until condition
Power Apps
Answered

Loop until condition

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have list of file names gallery controls. I wanted to check galley already contains when user adding new files. 

If it's exist, I wanted to add _1 at end of the filename. 

like DocumentName

      DocumentName_1

      DocumentName_2

Kindly help me how to do this in PowerApps. 

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    I assume there is a file list:

    ClearCollect(
     Gallerylist,
     {FileName:"DocumentName"},
     {FileName:"DocumentName_1"},
     {FileName:"DocumentName_2"}
    )

    I assume there is a text input control(TextInput9) to input file name

    You could use this formula to set the file name:

    If(
    IsEmpty(Filter(Gallerylist,First(Split(FileName,"_")).Result=TextInput9.Text)),
    TextInput9.Text,
    TextInput9.Text&"_"&Max(ForAll(Filter(Gallerylist,First(Split(FileName,"_")).Result="DocumentName"),Value(Last(Split(FileName,"_")).Result)),Value)+1
    )

    vbofengmsft_0-1643168024264.png

    vbofengmsft_1-1643168123667.png

    Best Regards,

    Bof

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard