Hi all,
We're running out of disk space on our cloud environment. Appian Support has identified that the main culprits are our Knowledge Centers. They can't however identify which specific Knowledge Centers are the largest. We have over a hundred though so it may just be an accumulation of them all.
But anyway, I need to find all their individual sizes and am hoping someone knows how to do this without manually checking each Knowledge Center's properties?
An option I'm trying is:
a!localVariables( local!knowledgeCenter: cons!ABC_KNOWLEDGE_CENTER_PROPERTIES, a!forEach( items: local!knowledgeCenter, expression: { creator: knowledgecenter(fv!item, "creator"), dateCreated: knowledgecenter(fv!item, "dateCreated"), description: knowledgecenter(fv!item, "description"), id: knowledgecenter(fv!item, "id"), name: knowledgecenter(fv!item, "name"), numberOfDocuments: knowledgecenter(fv!item, "numberOfDocuments"), size: knowledgecenter(fv!item, "size") / 1000000 & " MB" } ) )
Which outputs a useful list like this:
Thing is, the Constant I'm using in the expression... I need to manually add each Knowledge Center to that Constant which also seems like a long way round:
Does anybody please have a simpler way to get a list of all Knowledge Centers and their sizes?
Many thanks,Uel
Discussion posts and replies are publicly visible
I do it the following way. Notice that I use plugin "Content Tools":
a!localVariables( folders: fn!findcontentbyattribute( searchAllContent: true, contentType: "folder", attributeName: "name", searchCriteria: "*" ), kcIds: a!forEach( local!folders, if( isnull(fn!folder(fv!item, "parentFolderId")), fn!folder(fv!item, "knowledgeCenterId"), {} ) ), kcIds2: reject(fn!isnull, local!kcIds), kcIds3: rule!BK_RemoveDuplicates(local!kcIds2), kcMaps: a!forEach( local!kcIds3, a!map( id: fv!item, name: knowledgecenter(fv!item, "name"), numberOfDocuments: knowledgecenter(fv!item, "numberOfDocuments"), type: knowledgecenter(fv!item, "type"), size: knowledgecenter(fv!item, "size") ) ), a!forEach( local!kcMaps, if( or( fv!item.numberOfDocuments = 0, fv!item.type = 2/* Personal */ ), {}, fv!item ) ) )
I also use a function 'BK_RemoveDuplicates', that would be nice to have in the standard Appian repertoire:
/* The trick here is to use the union function: Apart from merging two (or more) lists, it also removes duplicates from the resulting list. */ union( cast(typeof(ri!list), {}), /* empty list */ ri!list )
Input 'list' is Any Type.
This looks good though I'd caution that in a production environment it might not be performant (at least in cases where there might be thousands or tens of thousands of procedurally generated subfolders i.e. in a personnel folder hierarchy). When I tried it, it sat "thinking" for 5 minutes then returned an error. Luckily it didn't do anything worse than that