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

Community site session details

Session Id : 9bIdmZfldadYPwSXAZ7ue5
Power Apps - Building Power Apps
Answered

Loop until condition

Like (0) ShareShare
ReportReport
Posted on 24 Jan 2022 12:52:31 by

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:
  • Verified answer
    v-bofeng-msft Profile Picture
    on 26 Jan 2022 at 03:35:31
    Re: Loop until condition

    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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete