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
18 replies
Subscribers
7 subscribers
Views
12847 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Removing deleted docs from a process variable
bojanb
over 7 years ago
Hi,
Do you have any idea how to remove all of the documents from a process variable that were previously physically deleted?
The deleted documents in the documents process variable (multiple) are shown as random numbers (for e.q. "85385235"...)
Please help me remove them and leave only the documents that are still valid (not deleted). Using Appian functions (not other plugins/smart services) is preferred.
Thank you in advanced...
OriginalPostID-245303
Discussion posts and replies are publicly visible
0
sikhivahans
over 7 years ago
@bojanb I believe something like below should work. I would suggest giving it a try.
fn!with(
\t/*where pv!array1 holds the ids of existing and non-existent(or deleted) documents*/
\tlocal!array1: fn!tointeger(pv!array1),
\t
\t/*where pv!array2 holds the ids of existing documents and random numbers because of deleted documents*/
\tlocal!array2: fn!tointeger(pv!array2),
\t
\tlocal!existingDocuments: fn!intersection(local!array1,local!array2),
\t
\tlocal!deletedDocumentIds: fn!difference(local!array1,local!existingDocuments),
\t
\tconcat("Existing document ids: ",local!existingDocuments,char(13),"Deleted document ids: ",local!deletedDocumentIds)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
bojanb
over 7 years ago
I will try that tomorrow, but I think it will not work, because in my case, array1 is in type string (it can be converted into integer) and array2 is in type DOCUMENT (it shows their names and I can not convert it to integer to show document ids, because some of the documents are valid and some already are shown as document numbers because they were previously deleted). I will confirm tomorrow for sure if it works... Thank you anyway... BR
PS: Those random numbers in array2 are actually the id numbers of the deleted docs
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
bojanb
over 7 years ago
@sikhivahans I tried your function - but id doesn't work in a process model - it gives me the following error:
There is a problem with task “Copy Document Service” in the process “Contract Request - C0074/2016”. The document 29,473 is not valid. It could not be downloaded successfully
The problem is when the function tries to do a tointeger of a document that has been previously deleted (and is not valid - it's shown as doc number). Any other ideas?
Thank you again... BR
PS: I tried the specified function as an expression rule before I implemented on a process model, and it worked - but I didn't try the scenario where the document was deleted (and shown as a doc number - that can be done only in appian instance)...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 7 years ago
@bojanb May I please know if the source of all the documents is the same folder or different folders?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
bojanb
over 7 years ago
At first the documents are put into one folder (Version 0.1). After the made changes in the documents in the folder, sometimes it happens the user no longer needs some file in that folder and deletes it. At that point, this file is shown in the process variable as a number (his document number) instead of his name (and this is logical, because the file no longer physically exist).
After this, the user continues the process where a new version folder is created (for e.q. Version 0.2) and all the files from Version 0.1 are copied into it. Here is the problem (when it tries to copy a non existing document).
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 7 years ago
@bojanb As far as my understanding is considered, I would suggest using a plugin caller 'Check object existence' and this determines whether a document id is valid or not. At the same time, I would suggest making changes in your process model in such a way that the main document variable is always updated prior to sending documents for deletion or post deletion of the documents. This is to ensure you don't need to depend on any document functions post deletion(as they will throw an error upon non-existence of objects) and organise the data properly in the variables prior to making any updates.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
bojanb
over 7 years ago
OK, thank you for all your suggestions... I wanted to know if there is some way to solve this without using an Appian plugin (to use the Appian base functions instead).
If I don't find any solution, I will have to install the plugin.
Anyway, i can not modify the process model, because the clients have access to the folders directly and the make the changes over there...and when they are done, they continue the process with initializing some quick task (depending what they want to do...).
Anyway, thank you again... I will continue to research a little bit more... BR
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 7 years ago
@bojanb Good luck, again my suggestion would be to organise and update the data properly in such a way that you don't need to depend on document() function post deletion of document objects as it ends up in a error upon seeing non-existent objects which will again introduce the necessity of plugin.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
<