Skip to main content
October 12, 2022
Solved

Get month from the date

  • October 12, 2022
  • 5 replies
  • 0 views

Hi Team,

I am trying to get the month, day and year from the date time. I was able to filter the records using a query, but the result is in a list type variant. 

I am unable to apply month/day functions to the fv!item.

If i write month[fv!item] i am getting the following error.

"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 16: Expression evaluation error at function 'month' [line 56]: A null parameter has been passed."

I believe it is because each individual item is itself a list.

I don't know how to drilldown the list.  fv!item[1] give me another error. 

"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 1: Expression evaluation error : Invalid index: Cannot index type Number (Integer) into type Date and Time".

Any help is appreciated. thanks

Best answer by gabriele.camilli
[quote userid="163011" url="~/discussions/f/data/26201/get-month-from-the-date"]"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 1: Expression evaluation error : Invalid index: Cannot index type Number (Integer) into type Date and Time".[/quote]

This happened because you tried to index fv!item, that was a single Date and Time variable

[quote userid="163011" url="~/discussions/f/data/26201/get-month-from-the-date"]"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 16: Expression evaluation error at function 'month' [line 56]: A null parameter has been passed."[/quote]

About this you could try a simple 

reject(fn!isnNull, local!reportOn)

If this is not enough look at the element and see which could be the problem

5 replies

harshitb6843
October 12, 2022

Can you try using a!flatten() and see if this solves your problem? 

Participating Frequently
October 12, 2022

The month function does not accept null values to handle that apply null check over it.

[quote userid="163011" url="~/discussions/f/data/26201/get-month-from-the-date"]"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 16: Expression evaluation error at function 'month' [line 56]: A null parameter has been passed."[/quote]

gabriele.camilli
October 12, 2022
[quote userid="163011" url="~/discussions/f/data/26201/get-month-from-the-date"]"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 1: Expression evaluation error : Invalid index: Cannot index type Number (Integer) into type Date and Time".[/quote]

This happened because you tried to index fv!item, that was a single Date and Time variable

[quote userid="163011" url="~/discussions/f/data/26201/get-month-from-the-date"]"Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 16: Expression evaluation error at function 'month' [line 56]: A null parameter has been passed."[/quote]

About this you could try a simple 

reject(fn!isnNull, local!reportOn)

If this is not enough look at the element and see which could be the problem

Participating Frequently
October 12, 2022

I think this should be applied to items on line number 48

current code

items: local!reportedOn

Change to 

items:reject(
  fn!isnull,
  a!flatten(
    local!reportedOn
  )
)