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.
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
)
Best Regards,
Bof