Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
I have requirement to get the no of documents created last day/yesterday in KC.
We have a function to get the number of documents present in KC : knowledgecenter(ri!folderId,"numberOfDocuments")
Can anyone please how to approach. Thanks in advance
Discussion posts and replies are publicly visible
a!localVariables( local!document: folder( cons!LSME_DOCUMENT_FOLDER, "documentChildren" ), local!dateCreated: a!forEach( items: local!document, expression: if( todate(document(fv!item, "dateCreated")) > today()-1, true(), false() ) ), length( remove( local!dateCreated, wherecontains(false(), local!dateCreated) ) ))
Thank you Prafuls0004. This solves my query
An alternative approach
a!localVariables( local!document: folder( cons!LSME_DOCUMENT_FOLDER, "documentChildren" ), sum( a!forEach( items: local!document, expression: todate(document(fv!item, "dateCreated")) > today()-1, ) ) )
When converting a boolean value into an integer, it becomes 0 for false and 1 for true. We can use that to calculate the sum of true values in a boolean list.
BTW, a comparison always evaluates to a boolean. Putting it into an if() will not make this a more elegant implementation.