Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Loop until condition

(0) ShareShare
ReportReport
Posted on 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
    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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard