cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CABIRD
Level: Powered On

Generate file name

Objective: Automatically generate unique file name for each image. Then use Flow to upload images to SharePoint photo asset library.

 

The code below works

UniqueFileName.png

 

Add textinput (AuditNumber) entry today's date coding  to create the unique file name and fails. See below.

 

DateFileName.png

Clearly I'm missing something obvious.

 

Can you help?

 

Thank you.  

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
CABIRD
Level: Powered On

Re: Generate file name

Hello

THIS ISN'T A SOLUTION

 

The below is a response to the previous question raised by wyotim the input text has an integer but I'd set this to text.  My intention is to convert an integer to text.

 

Text input set to 'text' not 'number.' In theory the code should work. 

 

Collect(PictureList,
			{ Image: UploadedImage1.Image, 
				ID: Concatenate(AuditNumber.Text,
				"-",
				Text(Today(),
				"[$-en-US][$-en US]dd:mm:yy"),
				"-",Text(CountRows(PictureList)+1),
				".jpg")
			}
		)

 

TextBox.png

Community Support Team
Community Support Team

Re: Generate file name

Hi @CABIRD ,

 

Could you please reference this:

Collect(PhotoList,{Photo:UploadedImage1.Image,FileName:Concatenate("File",Text(Today(),"[$-en-US]dd/mm/yyyy"),Text(CountRows(PhotoList)),".jpg")})

 

And I test with your formula expression, it works ok.

Collect(PictureList,
{ Photo: UploadedImage1.Image,
ID: Concatenate(AuditNumber.Text,
"-",
Text(Today(),
"[$-en-US]dd:mm:yy"),
"-",
Text(CountRows(PictureList)+1),
".jpg")
}
)

20190417collection1.PNG

 

Best Regards.

Yumia

6 REPLIES 6
Highlighted
Super User
Super User

Re: Generate file name

I may be looking at this wrong, but it looks like you are trying to put the file name in the ID field, which previously held an integer (or at least number) value. I would guess that you would want another place for that name, like a PictureName field or something like that. 

CABIRD
Level: Powered On

Re: Generate file name

Hello

THIS ISN'T A SOLUTION

 

The below is a response to the previous question raised by wyotim the input text has an integer but I'd set this to text.  My intention is to convert an integer to text.

 

Text input set to 'text' not 'number.' In theory the code should work. 

 

Collect(PictureList,
			{ Image: UploadedImage1.Image, 
				ID: Concatenate(AuditNumber.Text,
				"-",
				Text(Today(),
				"[$-en-US][$-en US]dd:mm:yy"),
				"-",Text(CountRows(PictureList)+1),
				".jpg")
			}
		)

 

TextBox.png

Community Support Team
Community Support Team

Re: Generate file name

Hi @CABIRD ,

 

Thanks for your post and your solution.

 

Best Regards.

Yumia

CABIRD
Level: Powered On

Re: Generate file name

Hello @v-yuxima-msft 

You misunderstood my submission.

 

Sorry my above submission isn't a solution. In theroy it should work but it simply doesn't. 

 

The code below functions. 

 

Collect(PictureList,{ Photo: Camera1.Photo, ID: CountRows(PictureList)+1 })

However expand the above code to the to the code  below

Collect(PictureList,
   { Photo: Camera1.Photo,
   ID: Concatenate(AuditNumber.Text,
   "-",
   Text(Today(),
   "[$-en-US]dd:mm:yy"),
   "-",
   Text(CountRows(PictureList)+1),
   ".jpg")
   }
  )
  

CodeError.png

The above implies Power Apps has a bug if the code  above is correct.  I would like to state the code worked in the past WITHOUT ISSUE.

 

Non descript error messages.

Issue1.pngIssue2.pngIssue3.pngissue4.pngIssue5.png

Can you help?

 

P.S. I cannot imagine there isn't a method to generate file names with meta data to upload to SharePoint list.

 

Thank you.

Community Support Team
Community Support Team

Re: Generate file name

Hi @CABIRD ,

 

Could you please reference this:

Collect(PhotoList,{Photo:UploadedImage1.Image,FileName:Concatenate("File",Text(Today(),"[$-en-US]dd/mm/yyyy"),Text(CountRows(PhotoList)),".jpg")})

 

And I test with your formula expression, it works ok.

Collect(PictureList,
{ Photo: UploadedImage1.Image,
ID: Concatenate(AuditNumber.Text,
"-",
Text(Today(),
"[$-en-US]dd:mm:yy"),
"-",
Text(CountRows(PictureList)+1),
".jpg")
}
)

20190417collection1.PNG

 

Best Regards.

Yumia

CABIRD
Level: Powered On

Re: Generate file name

Hello @v-yuxima-msft 

 

I note the date format change. Previosuly dd:mm:yy now dd/mm/yy I clearly missed the format change. Even worse it never occurred to me date format was the issue despite testing line by line.

 

Thank you for your help much appreciated.