Skip to main content
October 9, 2022
Question

A null parameter has been passed

  • October 9, 2022
  • 6 replies
  • 0 views

Hi all

I'm facing a problem when I try run this code:

a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextItem(
text: {
hour(ri!ES_Working_Hours_Record.LeavingTime - ri!ES_Working_Hours_Record.StartTime),
" hours",
if(
hour(ri!ES_Working_Hours_Record.LeavingTime - ri!ES_Working_Hours_Record.StartTime) = "8",

"
Working hours are complete",
if(
and(8 > hour(ri!ES_Working_Hours_Record.LeavingTime - ri!ES_Working_Hours_Record.StartTime) > 0),
"
Working hours are not complete",
if(
hour(ri!ES_Working_Hours_Record.LeavingTime - ri!ES_Working_Hours_Record.StartTime) = 0,
" insert working hours correctly please",
" working hours passed limit"
)
)
)
},
size: "STANDARD",
style: {
"STRONG"
}
)
}
)
},

I got this message: Error Evaluating UI Expression Expression evaluation error [evaluation ID = ] in rule 'es_working_hours_record2' at function 'hour' [line 33]: A null parameter has been passed.

I need to make it null, because I want the user who inserts these values, so I think it should be Null.

6 replies

harshitb6843
October 9, 2022

In that case, just add a null check. First check in an if() condition that the value you have passed in hour() function is null or not. If null, then don't call the hour() function but if it is not null, then call it. 

if(
    a!isnullOrEmpty(ri!value),
    null,
    hour(ri!value)
)

alim9650Author
October 11, 2022

Thanks for the answer

I've added the null check, but I got this: Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'hour' [line 36]: Could not cast from ES_Working_Hours_Record to Time. Details: CastInvalidCould not cast from ES_Working_Hours_Record to Time. Details: CastInvalid

namratak0001
October 11, 2022

Please add casting function todatetime() whenever you are referring to ES_Working_Hours_Record date time field