Skip to main content

Hi All

 

Hoping you can help.  I have a single doc gen action that creates 2 different documents (invoice & an order form).  Within the doc gen action there is only a single variable and I have called it “generated invoice & order form”. 

I then want to store the invoice in a folder (in box) called invoices and the order form in a folder called order forms, which are all setup etc and i can store both files in a single folder.  But now I try and store them separately and i seem to be struggling.

 

I have tried the “get item from collection action” and set to get index 0 for the first document template in my case invoice.  But although i have set the creating order of the 2 separate documents it randomly put them in the collection at different indexes (sometimes the invoice is index 0 sometimes its in index 1).  I have testing this without the storing and just using log instance details and this has proved it again that it changes the index in which it stores the created documents.

 

I have also tried things like find substring in string etc but nothing seems to work.  I have also tried moving a file once they are both stored but I cant seem to get a variable that will pick the latest file I created.

 

Any help appreciated

Hi @Andy.Emery,

Since you have a prefix string at the start of the filename you could do a regex on one of them when looping thorugh the collection and store it accordingly based on the match.

Cheers, Rick


@rickdemarco thanks for your reply, how does that work please? Not done a regex before 

 

thanks


Regex allows you to find a match of a certain string in the output e..g find the filename that has ‘invoice’ in it and that way you know where to store it.

With getting item from collection store the output in a text varaible and that will output a whole lot of characters with one being the file name. Then use Apply Regular Expression action on that output varaible, using match and expression of (\W|^)invoice(\W|$), this will check if that item in the collection has the word invoice and you can then do say a branch by condition as it will return Yes or No and then each branch could save to its relevant destination. If returns No then you know it’s the Order


Hi @rickdemarco 

Just got round to this and it works fine, thanks so much.  As you said I did a branch by condition on the true/false outcome of the regex and then got file from index 0 and then 1 depending on what branch it went down and then stored them separately 🙂 works perfectly thank you!!


Reply