Skip to main content
Known Participant
Sep 8, 2023 4:32 PM UTC
Solved

How to Generate Report Based on the User Filters

Hello,

In a interface using process model I'm generating the Report in Excel using Export Data Store Entity To Excel Smart Service on Monthly and daily basis, and in smart service inside filter field I'm providing filters to filter the data.

Now the requirement is that I need to take inputs from user like the From Time and To Time, and based on this I need to filter the data from the database and generate report in excel which is present between the time period provided by the user in interface. 

Thank you.

    mathieud0001
    Genius
    Sep 8, 2023 4:58 PM UTC

    a!localVariables(
      local!endDate: now(),
      local!startDateTime45Days: a!subtractDateTime(
        startDateTime: local!endDate,
        days: 45
      ),
      local!startDateTime: userdatetime(
        year(local!startDateTime45Days),
        month(local!startDateTime45Days),
        day(local!startDateTime45Days),
        0,
        0,
        0
      ),
      local!endDateTime: userdatetime(
        year(local!endDate),
        month(local!endDate),
        day(local!endDate),
        23,
        59,
        59
      ),
      a!queryFilter(
        field: "timestamp",
        operator: "BETWEEN",
        value: { local!startDateTime, local!endDateTime }
      )
    )

    I provided something similar to this in another thread you srtarted: https://community.appian.com/discussions/f/general/29915/to-find-if-a-given-date-is-from-previous-month

    7 replies

    mathieud0001
    Genius
    Sep 8, 2023 4:37 PM UTC

    Can't you just capture the values for those filters in your interface and pass them as process variables to your process and then build your queryFilters inside your process model based on those PVs?

    Known Participant
    Sep 8, 2023 4:42 PM UTC

    But if the user need the last 45 days record in excel, then how to implement it.

    mathieud0001
    Genius
    Sep 8, 2023 4:44 PM UTC

    You pass a startDate and endDate captured in your interface as PVs to your process and and you apply the filters using those dates?