You are viewing limited content. For full access, please sign in.

Question

Question

Renaming Attachments from Collections

asked on September 4, 2018

I have a process, started through forms, that is utilizing collections to upload different types of attachments.  I find that, for this form, collections work best, as tables do not allow for an attachment field, and there's no set number of files / attachments that are always going to be uploaded.

My problem is when it comes to saving these files in the repository. What is supposed to happen is that, based on the file type field above, the file in question should be renamed to that (ex., if type is "Booking Sheet," then the file should be renamed from whatever it was uploaded as to "Booking Sheet" once it is stored in the repository). I have found this more troublesome than expected though.

This isn't right because it just takes the different "types" of files, and combines their names. Example, if I have two files in that collection (one "Booking Sheet" and one "Case History") it renames both files on storage as "Booking Sheet; Case History" and "Booking Sheet; Case History (1)".

So then I thought I could have workflow handle it better. After reviewing some Answers posts, I came to the conclusion that this should work...

However, unless I'm doing this wrong - it doesn't work correctly either. It is just taking the first file in the collection and renaming everything that ("Booking Sheet," "Booking Sheet (1)".

Anyone else run into this and know the solution? It'd be greatly appreciated. Thank you!

0 0

Answer

SELECTED ANSWER
replied on September 4, 2018 Show version history

Hi Ryan,

Within Forms (starting with version 10.2.1), you can do this in the Save to Repository task by referencing the collection index when inserting a variable into the document name. The syntax would be {/dataset/Collection/Type[Row()]} where "Collection" is the name of the collection and "Type" is the variable you want to use to name the attachment. After inserting the Type variable using the variable picker, you'll have to manually insert [Row()] into the token.

Alternatively you should be able to accomplish this using a workflow that looks something like the following:

Essentially, you can loop through each file in your collection, and then reference the corresponding "Type" variable when specifying the file name in the "Create Entry" activity. Rather than looping through each collection row, you can use indexes to make sure you are using the appropriate name for each file. To do this, insert the "Type" variable in the Entry Name field, then right click the token and open the Token Editor. In the index field, insert the current file iteration:

Hope this helps!

4 0
replied on September 4, 2018

Worked like an absolute charm! Thank you so much! I was messing around with the iteration approach, but had not been doing it correctly. I used the workflow route as there are other steps involved and this makes storage of those files almost instantaneous, vs. the forms approach, which would have required a small delay in tasks prior to storing those files. Appreciate your help!

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.