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

Question

Question

How to save files uploaded to an attachment control in a table to a corresponding folder

asked on June 11, 2017

Hi,

I'm using LF 10.2 Forms (RIO). There is a requirement for multiple 1-many documents to be stored in LF folder structure as shown below.

What needs to result when these documents are uploaded is Respondent 1 folder has to be created to contain all of the documents and Respondent 2 folder to store corresponding files.

How can I achieve this outcome?

 

Thanks,

1 0

Answer

SELECTED ANSWER
replied on June 12, 2017

Hi Adarsh,

I recently came across this same issue,  saving the associated document(s) to a folder of each entry within a collection.   What I thought would (should?) be a simple task turned into a bit of work so I will share what I did.   If anyone knows an easier way to do this I would love to see it!

I want to input X number of users, create a folder with that users name and place the corresponding documents into the users folder from the form submission.

First my simple test form ready to be submitted:

Once the form is submitted I save the form and documents ( Collection\File ) to an incoming  Repository folder and then call my workflow.


the test workflow:

The first step, Retrieve BP Variables  I have 3:
Collection [Collection]
File (Collection [File Upload]
Username (Collection) [Text]


The 2nd step, 'For Each Row' iterates over my Collection


The 3rd step creates my user folder simply using the %(ForEachRow_Username) token


The 4th step iterates over each one of the attachment files submitted

and now things get a little more tricky ...

As I iterate over each file submitted I will use two tokens,  %(ForEachFile_CurrentFile_Path) and %(ForEachFile_CurrentFile_Name)

%(ForEachFile_CurrentFile_Path) is a bit misleading, it is not a folder path into the repository but a path of the Collection of files.  Since I submitted 2 users in this example I will get 2 paths
Collection\File\1 and Collection\File\2

With 2 users submitting 2 files each the full iteration over the File Collection would iterate 4 times:
%(ForEachFile_CurrentFile_Path)   %(ForEachFile_CurrentFile_Name)
Collection\File\1                            doco_1

Collection\File\1                            doco_2

Collection\File\2                            doco_4

Collection\File\2                            doco_5

So you can see (?) that the docs for Collection\File\1 are for the first user in our collection, and Collection\File\2 are for the second user in our collection  ( and on  Collection\File\X for x user )

Jumping back up to the 'For Each Row' action ...  I know the iteration number that I am on and the user it corresponds to  so in step 5 I use that token %(ForEachRow_Iteration) to do a conditional to see if my Collection\File\NUMBER matches the %(ForEachFile_CurrentFile_Path)

If it does, I know this file belongs to the %(ForEachRow_Username) but first I have to find the file in the repository with step 6, now that I know the name of the file.
{LF:Name="%(ForEachFile_CurrentFile_Name)", Type="D"} & {LF:LOOKIN="LFICHE\\tmp\test"}

However since I am also iterating over every file every time, I may have already moved the file so I do another conditional to make sure my search result found the file.
Step 7

If so I can move the file into the folder I created with the Create Entry activity, step 8.

Hope that made a little sense ......  happy to explain more if needed.

This workflow is not the most efficient since it will iterate over and search for files even after they have been moved.   You can improve efficiency by indexing tokens, etc but this was my test workflow and I think it explains the idea better than a more complicated flow.

The other caveat is if two files are uploaded with the same name you will have to do a little more work to determine which file is which!

In practice we are using a little more efficient workflow,  putting fields on our submitted documents to help with searches and trying to determine duplicate file name owners.  

I would love to hear of an easier way to do this but this does work ....

Andrew
 


 

2 0
replied on June 13, 2017

Hi Andrew,

Thanks for answering. I have just started implementing as per your suggestion, I will keep you posted :-)

Thanks,

Adarsh

0 0
replied on June 13, 2017

One thing to worry about with this approach is that if multiple attachments have the same name, they'll be renamed when saved to Laserfiche if you place them in the same folder.

1 0
replied on June 13, 2017

Hi Andrew,

Again, thank you so much for your detailed email.

I implemented what you suggested with the set of activities as shown below. I'm running one loop per attachment here.

The one exception it doesn't handle as you pointed out is when there are files with same names. We will instruct users to not upload files with same names.

I hope someone will advice us on that at some point.

0 0
replied on June 15, 2017

Glad that helped out Adarsh

For files with duplicate names you could start a search for  filename (1), filename (2) ... until a match was found when the original name was not found.   It seems that files are uploaded and named in the order they were submitted in but what have to confirm that.  You could also check the incoming folder to see if there are any remaining files and send a notification to process them manually since everything submitted should be moved.   Assigning field values to the documents when they are saved would help out here when determining if they all moved.

For all the work it took putting this together we had to abandon it since our customer has a need for pages to be generated from the incoming attachments.   Attachments submitted via a form do not have an option to have pages generated or is there a way within workflow to do this.   Our attachments now need to be emailed to someone so that they can manually put them into the repository and have pages generated.  A huge disconnect in our otherwise automated process.

Miruna,  I know it's been discussed a lot here in Answers, along with some of the reasons it's not available, but there really is a need to automate generating pages.   If nothing else at least the attachments submitted from Forms !!!

1 0
replied on June 18, 2017

Thanks for the steps, will keep that in mind.

W.r.t. page generation, I completely agree with you. I'm currently resorting to using Schedule OCR activity but that only goes so far.

Thanks,

Adarsh

0 0

Replies

replied on June 11, 2017

Hi Adarsh,

There is a new feature in Forms 10.2.1 that let you get value of another field in the same row of a collection/table when save attachments to repository. The token is like {/dataset/Table/Column_1[Row()]}

But that token only works in attachment name and fields, not in the document path. I filed a feature request for that.

For now, one possible solution is to set the value in attachment metadata fields, then use Workflow to move attachments to destination folder according to the field value. The Workflow could be like this:

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.