Skip to main content
moulikad5353
Known Participant
Jun 9, 2023 2:24 PM UTC
Question

A null parameter has been passed for month function

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

sanchitg0002
Inspiring
Jun 9, 2023 2:28 PM UTC

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
Known Participant
Jun 9, 2023 2:35 PM UTC

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

sanchitg0002
Inspiring
Jun 9, 2023 2:40 PM UTC

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

Participating Frequently
Jun 9, 2023 2:42 PM UTC

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
Known Participant
Jun 9, 2023 2:45 PM UTC

So how to write that?

Participating Frequently
Jun 9, 2023 2:50 PM UTC

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.