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
5 replies
Subscribers
7 subscribers
Views
2025 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
not getting downloadLink some times
praveenkumark
over 8 years ago
Hii#All ---not getting downloadLink some times for the Document in a grid
please provide any suggestions on this
Thanks,
Praveen
OriginalPostID-234119
Code.txt
Discussion posts and replies are publicly visible
0
praveenkumark
over 8 years ago
attached screen Shot UI
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aayusha
Certified Senior Developer
over 8 years ago
Can you please share the code?
I suspect, the apply rule has not been implemented on the link.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@praveenkumark Isn't it worth writing rules as follows and reuse them as and when required?
emobUtilIsValidDocument
1. documentId_int (Number Integer)
fn!if(
\tfn!isnull(ri!documentId_int),
\tfalse,
\tfn!isObjectExists("Document",ri!documentId_int)
\t/* isObjectExists avaliable at http://bit.ly/2coVGoM and safely ignores invalid document objects */
)
eumobUiDocumentDownloadLink
1. documentId (Number Integer)
fn!if(
\trule!emobUtilIsValidDocument(documentId_int:ri!documentId_int),
\ta!documentDownloadLink(label:fn!document(ri!documentId_int,"name"),document:ri!documentId_int),
\tnull
)
And apply in your implementation as follows:
links: if(rule!APN_isEmpty(data.tAttachmentids),{},apply(rule!eumobUiDocumentDownloadLink,data.tAttachmentids))
As far as my knowledge is considered, you shouldn't remove the nulls and apply documentDownloadLink function. Let the nulls or invalid document ids be present in the actual data(provide to 'links attribute') similar to the nulls or invalid document ids present in the actual data in the 'data' attribute. Apply a!documentDownloadLink only on those elements that evaluate to proper document objects and don't apply it when the check evaluates to false. This way, you can make sure that the number of links is equal to the number of elements in data and can eliminate the mismatch between the both. Also, you can safely avoid invalid document objects(where document id is in the database but the actual document object is deleted), nulls and array handling which might cause errors at times.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
*(provided to')
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jagadeesh
Certified Lead Developer
over 8 years ago
@praveen if you keep a!documentDownloadLink(_) in a rule and call it from apply loop.. I was faced same issue when I am new to appian but the solution what was given above solved my problem ..
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel