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
12 replies
Subscribers
7 subscribers
Views
3964 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I'm having an issue in upload document. The situation is that I have to disp
gaurava322
over 7 years ago
I'm having an issue in upload document. The situation is that I have to display the Upload Document control in a grid and once it is uploaded i need to store the document ID in DB. And if i'am again returning to this screen, and since i have already uploaded the document earlier and it is in DB, it should show the link to that document. In gridRowLayout, i am doing following:
if(
rule!APN_isBlank(ri!items[ri!index].appianDocId),
a!fileUploadField(
value: ri!items[ri!index].appianDocId,
saveInto: ri!items[ri!index].appianDocId,
target: cons!WMG_GBL_UPLOADED_DOCS_TARGET,
readOnly: true,
align: "RIGHT"
),
a!linkField(
label: "",
links: {
a!documentDownloadLink(
label: ri!items[ri!index].appianDocId,
document: ri!items[ri!index].appianDocId
)
}
)
)
Now the problem is as soon as i upload the document in the cell i...
OriginalPostID-212534
OriginalPostID-212534
Discussion posts and replies are publicly visible
0
gaurava322
over 7 years ago
... get following: "[Document:185625]".
I tried modifying the label: document(ri!items[ri!index].appianDocId,"name"). So that i can get the name of the document.
I am getting error: Interface Definition: Expression evaluation error in rule 'testRowLayout' at function a!applyComponents [line 55]: Error evaluating function 'document' : Expression evaluation error : Invalid function document.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 7 years ago
@gaurava Hi, would you be able to add some information with regards to how you are uploading the document(that is, are you submitting the form after the completion of document upload), how you are populating the documentId field in the CDT thereafter? At a very high level, what I could predict as of now, you are tying to utilise the temporary document object(the document uploaded in task becomes an actual document object after the form submission) and trying to obtain the properties of the same using fn!document() which actually throws an error as the temporary document hasn't become a actual document yet.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sonalk
over 7 years ago
Hi Gaurav,
Added to the above, have a look at the posts shared in the link below, can be useful for you to resolve the issue.
forum.appian.com/.../e-190261
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sagarl511
A Score Level 2
over 7 years ago
@gaurava322 - Are you using document download link in editable grid? As I get your question you are trying to show link after submission of form.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
kumaraveln
over 7 years ago
@Gaurav: Don't try to capture the document id as an integer (saveInto: ri!items[ri!index].appianDocId) at the point of uploading. Use a pv of type document. Upon submission of the form get the document id using document(pv!yourDocVar, "id") and store it into your CDT variable. If there are multiple documents, define document of type multiple and loop through them and get the respective integer document ids. Your retrieval logic is perfect and no change is required there.
This approach is required because of Appian's way of handling documents. As other practitioner's mentioned, Appian will create the document in a temporary location with a temporary id at the point of upload and recreate them in the target folder (and remove the temporary document) with a new document id only at the point of form submit. If you don't use a pv variable, you will not be able to get the actual document id in anyway using the temporary document id. The temporary document id is no longer referencing any object in Appian and hence you get this error.
Please refer the below thread and post back if you have any question
/search?q=OriginalPostID-132941
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
yaswanthreddya
over 7 years ago
Hi Gaurav,
I would like to suggest that to check the following: 1. How you are getting the Document ID? (It should be after the submission of form and check it in test rule whether it is getting actual Document Id or not)
2. Check in DB whether actual document Id is stored or not?(after the submission of form)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sidhant Behura
over 7 years ago
@gaurava322- There is a small problem here.I have replicated the issue. I am sure the appianDocId type is "Text". Please change it to Integer and it will work.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sidhant Behura
over 7 years ago
@gaurava322- The ri!items.appianDocId cdt field is of type "Text", change it to "Integer". Attaching screenshots of what happens when the appianDocId is "Text" and "Integer".
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sidhant Behura
over 7 years ago
@gaurava322-
I interpretted the issue in a different way.Please refer the below solution.
For saving the document into the target knowledge center and for avoiding "'document' : Expression evaluation error : Invalid function document." error you can have a buttonWidgetSubmit with name "Upload" and style "NORMAL" which upon clicking submits the form, goes into the process model (which helps the document getting upload into the targeted KC) and then comes back to the same form immediately through activity chaining.
There should be a XOR gate which should check that the submit action was from the Upload button not from actual submit button.
After the XOR check there should be a script task by which you can initialize the document id(s) cdt field with the actual document id(s).
Now as you have the actual document id(s) you can convert it into a document and perform a variety of operations like fetching the name, size, download etc.
Hope the information was helpful.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 7 years ago
To all of the above I'd just like to add one point on technique that can help de-clutter the process model of unnecessary extra PVs (and gateways). While it is required to save the uploaded document into its own document-type RI, assoicatied to a document-type ACP, it's not necessary to pass that back into a PV; you can instead use logic in the node output to check whether ac!uploadedDocument was populated, and if so, store its ID value into pv!myCdt.appianDocId.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>