I have a requirement to get the top 3 documents list which are larger in size in a KC.
I was a able to get the complete list with getfileslargerthansize() but doesn't know how to get top 3 documents onlly.
Can anyone please help. Thanks in Advance
Discussion posts and replies are publicly visible
Create a list of maps with two fields each. The document and the size. Then use todatasubset to sort by size and set the batch size to 3.
Check the below code.
a!localVariables( local!xyz:a!forEach( items: getfileslargerthansize( tofolder(131788),/*knowledge center*/ 2000000/*document size*/ ), expression: { size:document( fv!item,"size" ), name:fv!item } ), index(local!xyz,wherecontains( index( /*I have used the sort plugin here */ sortintegerarray( local!xyz.size, true() ),enumerate(3)+1,{}), tointeger(index(local!xyz,"size",{})) ),{}), )