Hi,
I have list of files on UI which i want to download in zip folder.
What is the way out to implement this approach.
Kindly share me any code or any approach on this ?
Discussion posts and replies are publicly visible
Below plugin will help
https://community.appian.com/b/appmarket/posts/document-zipper
You can also have a look at - https://community.appian.com/b/appmarket/posts/add-documents-to-zip.
I have tried to change document n documentPath variable but now new error is poping up.
documents:12754,
documentPath:document(12754, "name"),
I am not sure what i am passing in document n documentPath is correct or not. I feel so error is around this variable only.
And then tried with below parameters also.
document:- reject(fn!isnull, a!forEach( items: index( local!dataset.data, "docId", null ), expression: if( or( isnull( fv!item ), not( isobjectexists( "Document", tointeger( fv!item ) ) ) ), null, document( tointeger( fv!item ), "name" ) ) )), documentPath:- reject(fn!isnull, difference(a!forEach( items: index( local!datasubset.data, "docId", null ), expression: if( or( isnull( fv!item ), not( isobjectexists( "Document", tointeger( fv!item ) ) ) ), "", document( tointeger( fv!item ), "name" ) ) ),"")),
But getting below error.
I'm not sure if this is what's causing your error, but you should be aware that the smart service expects you to provide the full document name as I mentioned before, which is the name + extension (so far your code just passes the name). For example,
document(fv!item, "name") & "." & "document(fv!item, "extension")
It might still work without the extensions, but your resulting zip file will end up with files without extensions which you probably don't want.
Other than this, all I can suggest is monitor a running instance and make sure your PVs have populated correctly - most importantly, pv!documents (should be either an array of document or an array of integer, the node will correctly typecast what it needs from either of these), and pv!documentPath (this needs to also be an array of course, at the very least containing the full name of each document in the array).
Hi Mike,
As i have shared my code in that i passing documents(array of doc id) and now i changed documentpath (array of name). But still java.lang.ArrayIndexOutOfBoundsException: 0
But if i change documents value to same as documentpath then i get java.lang.NullPointerException: Null Arguments are Invalid
It means documents(array of doc id) is correct format i feel so as per exception.
Why this ArrayIndexOutOfBoundsException this coming ?
I'm not sure what the source of that error is - the only thing I can suggest is to verify that your inputs are being entered correctly and correctly populated within the process instance. Can you post a screenshot of the values of "documents" and "documentPath" from within a process instance? It sounds almost as if one of the required values for the node is actually set as something invalid within the process instance (such as 0, or an empty set).
documents:-1245;1232;4567
documentPath:-test-sample.csv.2014-06-13; test-sample.csv.2014-06-25; test-sample.csv.2014-06-13;
Exact these values are going to PM.
I can't tell for sure until you post a screenshot, but it looks as if your "documentPath" array has a null entry at the end there. I expect that might cause unexpected issues when you feed the arrays into the zip file node, as it expects 2 arrays of the same length (and the document path values would never be null).
There is no null entry in this. I have verified with count() function . I have simply printed on my interface in text field. Even i have used reject function also to remove null n blank entires. So i am sure on that part.
Please provide a screnshot of this when you can, as there's not much more I can think of to troubleshoot without it. For example, here's mine:
you were absolutely correct.
But dono how its possible.
I think you need to go back to the expression you're using to pull your doc IDs and troubleshoot more. Perhaps comment out the startProcess() call temporarily and just write the docIds and docNames into local variables which you then display in a debug field on your interface.
If you see the code. It is returning values but i feel so type is not type of Document that's why in PM its coming null values.Otherwise on interface in textField its is returning list of id's.Anyways i got the pointer to more trouble shoot this. Thanks for pushing your inputs in this issue.
Now both variables are getting populate at PM side also but error is still same java.lang.ArrayIndexOutOfBoundsException: 0
Please if you can, post a screenshot matching the one I posted earlier (a screenshot of the PV variables in your process instance, at a minimum showing both the document ID and document name PVs), otherwise all I can do is continue to guess blindly.
I have changed complete code now n moved to Document Zipper.
Here i am able to successfully create a zip file. I know this is might be more tedious then other one but here i was able to move smoothly.
This one is also very straight forward where i have just followed some steps and achieved my requirement.
1. Create New Folder
2. Move Folder(need looping to move multiple files)
3.Document Zipper plugin
It took my a lot of efforts but i learned a lot by doing this and by your inputs as always.
Thanks for your inputs n your time .