I'm having an issue in upload document. The situation is that I have to disp

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

  • Gaurav,
    The variable ri!items[ri!index].appianDocId has the value like "[Document:185625]" instead of only numbers like 185625.
    You can achieve this through
    a) While retrieving the value from the DB you can get only the values
    E.g-1: Assume the result is stored in a CDT called documentDtls_cdt
    You have to extract the values like ri!documentDtls_cdt.documentId
    b) String Handling
    E.g-2: Use string operation "[Document: 185625]” and extract the number and ignore the [Document:]
    (a) is best approach.
  • As mschmitt said, use of pv! variables can be eliminated by extracting the information directly from ac! variables in the output section of human task .. But if something goes wrong it would be difficult to understand whether the document object is captured properly from UI and which index are empty (or has value) in case if it is multiple .. You can keep the pv! till your logic is implemented and working perfectly and then remove them and map the rule directly to the ac's

    My opinion is to still keep the pv variables for debugging purpose, as few pv's of document type and the fact that they are used only within the same process should not cause a memory issue