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
8 subscribers
Views
1728 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
not getting downloadLink some times
praveenkumark
over 7 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
Parents
0
sikhivahans
over 7 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
Reply
0
sikhivahans
over 7 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
Children
No Data