Not able to configure User Filters in Record

I have to create a user filter

Filter on the basis of month selected. I have data, but that coming in DateTime format. I tried converting it to simple Month name, but unable to do that using tools provided in User Filters Expression editor. Below is my code.

a!localVariables(
  local!month: text(
    "RequestedDate",  /*DATA COMING IN DATETIME FORMAT, TRYING TO CHANGE HERE IN MONTH NAME*/
    "MMMM"
  ),
  a!recordFilterList(
    name: "Month",
    options: a!forEach(
      items: cons!OSR_TEXT_ARRAY_MONTHS, /*ARRAY OF MONTH NAMES eg. January, etc.*/
      expression: a!recordFilterListOption(
        id: fv!index,
        name: fv!item,
        filter: a!queryFilter(
          field: local!month,
          operator: "=",
          value: fv!item
        )
      )
    )
  )
)

Thanks

  • Hi Varun,

                  In the above code, you have to pass the actual column name in the field and not local variable(field: "RequestedDate").

    In value, assume if month jan is selected, you have set operator as between and pass the first and last date of that month.

    Rather than doing this, its easier to create a view and add a new column in it which has only Month based on the datetime field and record can be created on top of this view. You can refer this column for querying the data.

    Thanks,

    Vadivelan

  • Thanks for the reply... but this is not filtering, below is the code I am using...

    a!recordFilterList(
      name: "Month",
      options: a!forEach(
        items: cons!OSR_TEXT_ARRAY_MONTHS,
        expression: a!localVariables(
          local!monthNumber: wherecontains(
            fv!item,
            cons!OSR_TEXT_ARRAY_MONTHS
          ),
          local!startDate: dateTime(
            year(
              today()
            ),
            local!monthNumber,
            1,
            0,
            0,
            0,
            0
          ),
          local!endDate: eomonth(
            local!startDate,
            0
          ) + intervalds(
            23,
            59,
            59
          ),
          a!recordFilterListOption(
            id: fv!index,
            name: fv!item,
            filter: a!queryFilter(
              field: "RequestedDate",
              operator: "between",
              value: {local!startDate, local!endDate}
            )
          )
        )
      )
    )

 Discussion posts and replies are publicly visible