Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
9 replies
Subscribers
7 subscribers
Views
3489 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hi, I have paging grid to show all documents and I want to create a
Sachin Pandey
A Score Level 1
over 9 years ago
Hi,
I have paging grid to show all documents and I want to create a link to the document for download. There is a link created but not to the document. Any suggestions on expression so i can get the link to document?
Expression:
a!gridTextColumn(
label: "Name",
field: "appiandocumentid",
data: local!datasubset.data.name,
links:apply(a!documentDownloadLink(document:_), index(local!datasubset.data, "appiandocumentid", {}))
),
OriginalPostID-173948
OriginalPostID-173948
Discussion posts and replies are publicly visible
0
Stefan Helzle
A Score Level 3
over 9 years ago
Your code seems to be OK. How is the datasubset looking? Do the document IDs point to the right file? Have you tried printing your data to screen to see what is actually in it?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rishirajk
A Score Level 1
over 9 years ago
Can you please check if the name of the field in the cdt of the datasubset is "appiandocumentid" not the field name of the grid column?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jaggu
over 9 years ago
I assume you are not storing documentId properly in DB. Doc Id which you get after uploading doc is less than 1 by actual doc ID,
I mean If you upload a doc and if its appian ID is 2247 , process model gives you 2246, so while saving doc id in DB add '1' to it and save, so retrival will not give error and you'll get document in download link.
If you have saved correct doc ID and not able to retrive, then use todocument() and check.
apply(a!documentDownloadLink(document:_), todocument(index(local!datasubset.data, "appiandocumentid", {})))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
That is very dangerous. A document uploaded in a SAIL form is saved to Appian DMS on submit of the form and the CORRECT id is saved to the AC variable of the user input task. When you use this id in the output definition of the task it is fine and should not be increased.
The problem with the document ids is with trying to access the id inside the form without submitting. This can be circumvented using some hacks but is risky.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jaggu
over 9 years ago
Stefan, I remember there was post to download document without form submit, But I don't know exact URL,
And Doc ID in ac variable in actual docId-1, PFA
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
brettf
over 9 years ago
The temporary document ID stored in SAIL before form submission is not guaranteed to be actual docId-1. If you have more than one document upload on a form, this will change. The only way I know of to guarantee that you get the document ID correctly is to save it off as a form input and utilize it as an AC parameter into the form via the process model.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
brettf
over 9 years ago
In addition, if you have a document as a part of a CDT, it will not update the document ID correctly. You need to have the documents as separate inputs to the form, and then use a script task afterwards to map the document(s) to the proper parts of the CDT. You might be able to do it on the output of the AC within the user input task, but I have not personally tried it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sachin Pandey
A Score Level 1
over 9 years ago
thank you ! i got it working
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sachin Pandey
A Score Level 1
over 9 years ago
Working Code:
a!gridTextColumn(
label: "Name",
field: "appiandocumentid",
data: property(local!datasubset.data, "name", {}),
links: {
apply(
a!documentDownloadLink(document:_),
property(local!datasubset.data, "appianDocumentId", {})
)
}
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel