0

I know its wrong, I just don't know why.

I have a library of images. I am trying to create a flow that will place the same content that auto-populates into the 'Name' column, when an image is uploaded, into the default 'Title' column as well.

I want to create a calculated column based on extracted components of the image name in 'Name', however, by SP default I cannot see the column 'Name' as an option when creating a calculated column; however, I can see the column 'Title'; however, however no data auto-populates into 'Title'; hence the need for the flow. I hope that's clear enough. :-)

note: The 'UploadedCerts&Quals' is not a "List" but a Document Library, if that matters.

enter image description here

1 Answer 1

1

The following updates document [Title] with the file name without extension. If you need to keep the extension, just update [Title] with varFileName, which has been initialized with FileNameWithExtension from the Dynamic content.

To remove file extension:

substring(variables('varFileName'), 0, indexOf(variables('varFileName'),'.'))

enter image description here

enter image description here

Updating this post to populate [Title] from File Name for existing records

Steps:

  1. Get all properties of existing files with null or empty [Title]
  2. Add a Compose action to verify the number of files with empty [Title]. This is not required though
  3. Update each file's [Title] property by using a [Apply to each] action by adding within it a [Set variable] and a [Update item] actions as shown in the screenshots below.

enter image description here

Expression 1

(type length() first in the expression window and then select [value] list of items from the Dynamic content)

 length(outputs('Get_files_(properties_only)')?['body/value'])

Detail 1

enter image description here

Expression 2, 3, & 4

2) FilenameWithExtension - from Dynamic content
items('Apply_to_each')?['{FilenameWithExtension}']

3) [ID] - from Dynamic content

items('Apply_to_each')?['ID']

4) Extract [Title] from varFileName. Expression window 

substring(variables('varFileName'), 0, indexOf(variables('varFileName'),'.'))

11
  • I made the changes and got the following error: Unable to process template language expressions in action 'Update_item' inputs at line '1' and column '2932': 'The template language function 'substring' parameter is out of range: 'start index' must be non-negative integer and should be less than the length of the string.
    – Curtis
    Dec 4, 2020 at 21:09
  • What is in the [Name] of the file. Do you have a dot (.) in your file name? Instead of using the expression substring(..), first use the variable varFileName to see if the [Title] gets populated. When you look into the history of the flow execution, you can see the values of varFileName, can you post that for me? Dec 4, 2020 at 21:14
  • My apology; yes, it working. If I add a file the 'Name' now also populates into 'Title'. This only works for 'newly created or changed files. Is there a way to initiate this action on the files that I've already uploaded (2,700 of them)? Or, do I have to reload each file in order to get the Name into the Title with the flow?
    – Curtis
    Dec 5, 2020 at 14:42
  • You don't have to do that. You create a separate flow and run it manually once to update [Title] for each file. Basically, the same thing, but: 1) need to retrieve all files properties 2) loop through each one and then update it. If you need help, I can update my post for that Dec 5, 2020 at 15:21
  • Oh yes, please!!!!! Without your help I'll be here all day trying to figure out what comma or parenthesis goes where. If you could provide ANY assistance in this regard I would be grateful.
    – Curtis
    Dec 5, 2020 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.