Skip to main content
Inspiring
Sep 29, 2022 9:56 AM UTC
Solved

To get no of documents created last month in the environment

Hi,

I have a requirement where I need to get the total no of documents created last month in the environment.

I have added all the document folders in a constant and tried to fetch the documents count but I'm getting an error as "The passed parameter(s) are of the wrong type. Received the type List of Folder."

a!localVariables(
local!document: folder(
cons!DMF_DOCUMENT_FOLDERS_LIST,
"documentChildren"
),
sum(
a!forEach(
items: local!document,
expression: todate(document(fv!item, "dateCreated")) > today()-30,
)
)
)

Can anyone please help me.

    harshitb6843
    Brainy
    Sep 29, 2022 10:30 AM UTC

    local!document: a!flatten(
      a!forEach(
        items: cons!DMF_DOCUMENT_FOLDERS_LIST,
        expression: folder(fv!item, "documentChildren")
      )
    ),

    9 replies

    Participating Frequently
    Sep 29, 2022 10:17 AM UTC

    Can you share the screenshot for the values which you have in your local variable actually this is working I tried using the same code it is working. Have you tested it?

    Inspiring
    Sep 29, 2022 10:24 AM UTC

    Hi Ujjwal,

    PFB screenshot with the values in the constant.

    The code is working with individual folder. But I want for list of all the document folders in the environment.

    Participating Frequently
    Sep 29, 2022 10:27 AM UTC

    Ohhh I took it like you are storing folder in the constant.

    harshitb6843
    Brainy
    Sep 29, 2022 10:19 AM UTC

    The error is very specific. If it is not working with a list, you might have to iterate through that so you can pass an individual folder instead a list.

    Inspiring
    Sep 29, 2022 10:26 AM UTC

    Hi Harshit,

    Yeah, it worked when I passed individual folder but I want for list of all the document folders in the environment. Could you please help if we have any way other than this.

    harshitb6843
    Brainy
    Sep 29, 2022 10:30 AM UTC

    local!document: a!flatten(
      a!forEach(
        items: cons!DMF_DOCUMENT_FOLDERS_LIST,
        expression: folder(fv!item, "documentChildren")
      )
    ),