Requirement: Sore uploaded docx ids array in DB column and get array to display uploaded list on UI.
1.Upload Multiple doc and get all docs array ids in local or ri variables, how to achieve? <-- 2.Is this correct approach to store multiple docx ids as array in DB column and retrieve from DB
Using Appian documentation i was able to download multiple document from an array of {docid1,docid2,docid3}
3.How to convert? from Appian multi upload stores i.e. {fn!todocument(6645),fn!todocument(7570)} to expected {6645,7570} <-- 4.How to store/retrieve this docid array in DB ? how to design DB with integer array?
5.May be I am wrong in above approach please let me know best approach to achieve above?
Discussion posts and replies are publicly visible
Check out the examples in the link below, particularly Multiple File Upload with Files. Also make sure to read through the Notes section.
docs.appian.com/.../File_Upload_Component.html
Hi,
I used above example but not getting array with Ids - Actually getting [documentid1-documentname1,documentid2-documentname2] format list.
Expected output docIds only- [documentid1,documentid2]
I was able to download multiple file using array DocArr:{docId1,docid2}
a!forEach( items: {6645,7570}, expression: a!linkField( label: "Link", labelPosition: "ABOVE", links: { a!documentDownloadLink( label: document( fv!item, "id" ), document:todocument( fv!item ) )} )
This is the way how Appian displays the data type "Document". Internally this is just an ID. Does this help?
That helps, This ids: {6645,7570} want to store in DB column and retrieve for above example, but appian doesn't do that, it shows only [6645 - file1.jpg,7570-file2.jpg],
How to convert? from [6645 - file1.jpg,7570-file2.jpg] to {6645,7570}
Use the document function: document("id", ri!document)
What do you mean with "allow"? There is not need to convert anything. As long as you use the type "document" in CDTs, Appian just makes it work. In case you want to display the documents in a list, use the document() function to extract the required data.
I am not able to use document(), any example will help me to understand.
The example Carlos Santander gave above is actually backwards. The proper syntax for 'document()' is "document(ri!docId, "property")", where instead of "property" you type the property you want to retrieve - like "id", "name", "extension", etc.
However if you're just after the ID, then there's no need whatsoever to use document() since your document type variables already contain the ID. Sometimes it helps to cast the document-type variable to integer using toInteger(), but it's really not strictly necessary most of the time.
Mike Schmitt said:The example Carlos Santander gave above is actually backwards
Good catch, thanks!
Multiuploaded document expression is like :{fn!todocument(7776), fn!todocument(7775)} want to get as {7776,7775}
Deepak Shinde said:Multiuploaded document expression
What exactly are you referring to, with "multiuploaded document expression"?
I am referring File Upload Functionality, I am able to store and download locally using type!Document in ri!. Only i need to know is how to store {fn!todocument(7776), fn!todocument(7775)} in DB? what type? then how to retrieve list of file for downloading?
You should be able to simply store the upload doc IDs into the appropriate property of a CDT, where the type of that property is either Integer or Document. Either of these will store to the DB as Integer type.
If you're trying to store multiple document IDs relating to one particular row in your DB table, the normal and more-normalized way of doing this would be to create a new table which would store one row per document ID, and basically just stores the document ID, as well as the row ID of the parent table. Generally speaking this scales better and is more flexible than hardcoding an array of document IDs (for example stored as text) into one row of the parent table. If you absolutely must go with the method of storing all doc IDs in a single cell of your base table, I'd consider converting the doc ID array to a JSON string, via a!toJson, prior to storing it. This will make parsing easier later on.