Skip to main content
moulikad5353
June 9, 2023
Question

A null parameter has been passed for month function

  • June 9, 2023
  • 18 replies
  • 0 views

When I write a code "month(fv!item.asDate) = local!month", why it's showing a result A null parameter has been passed. How to resolve that part?

Also I put that part

if(
a!isnullOrEmpty(index(fv!item, "asDate", null)),
false,
contains(
tointeger(local!month),
month(index(fv!item, "asDate", null))
)
),

but same error as it is

18 replies

June 9, 2023

You need to first check that the date you are passing in month() is not null, add an if condition to it.

if(
  isnull(fv!item.asDate),
  false,
  month(fv!item.asDate) = local!month
)

moulikad5353
June 9, 2023

No, it's not working. same error also showing

June 9, 2023

Are you sure that the error is due to month() only? Can you post screenshot of the error?

June 9, 2023

Always make sure to make expressions null-safe. i.e. don't process any value that you know already is null.

For the rest the error given is rather clear.

moulikad5353
June 9, 2023

So how to write that?

June 9, 2023

a!forEach(
  local!items,
  if(
    a!isnullOrEmpty(index(fv!item, "asDate", null)),
    false,
    contains(
      tointeger(local!month),
      month(index(fv!item, "asDate", null))
    )
  )
)


For instance the above. I added some additional checks since I don't know your data.