Interface Definition: Expression evaluation error at function a!forEach [line 48]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'datetime' [line 88]: Cannot construct timestamp from invalid date

a!localVariables(
local!Leave: 'type!{urn:com:appian:types}HN_AS_LeaveDetails'(),

{
a!gridLayout(
label: "Leave Details",
labelPosition: "ABOVE",
instructions:"Please add the records",
headerCells: {
a!gridLayoutHeaderCell(label: "Employee Number"),
a!gridLayoutHeaderCell(
label: "Leave Type"
),
a!gridLayoutHeaderCell(
label: "From Date"
),
a!gridLayoutHeaderCell(
label: "To Date"
),
a!gridLayoutHeaderCell(
label: "No Of Hours"
),
a!gridLayoutHeaderCell(
label: ""
)
},
columnConfigs: {
a!gridLayoutColumnConfig(
width: "NARROW"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "NARROW"
),
a!gridLayoutColumnConfig(
width: "ICON"
)
},
rows: {
a!forEach(
items: ri!AS_LeaveDetails,
expression:a!gridRowLayout(
contents: {
a!textField(
label: "Employee Number",
labelPosition: "ABOVE",
value: fv!item.Employee_Number,
saveInto: fv!item.Employee_Number,
refreshAfter: "UNFOCUS",
validations: {}
),
a!dropdownField(
label: "Leave Type",
labelPosition: "ABOVE",
placeholder: "--- Select Leave Type ---",
choiceLabels: {"Annual", "Statutory", "Maternity"},
choiceValues: {"Annual", "Statutory", "Maternity"},
value: fv!item.Leave_Type,
saveInto: fv!item.Leave_Type,
searchDisplay: "AUTO",
validations: {}
),
a!dateTimeField(
label: "From Date",
labelPosition: "ABOVE",
value: fv!item.From_Date,
saveInto: fv!item.From_Date,
validations: {}
),
a!dateTimeField(
label: "To Date",
labelPosition: "ABOVE",
value: fv!item.To_Date,
saveInto: fv!item.To_Date,
validations: {}
),
a!integerField(
label: "No of hours",
labelPosition: "ABOVE",
value: calworkhours(datetime(fv!item.From_Date),
datetime(fv!item.To_Date)),
refreshAfter: "UNFOCUS",
readOnly: true,
validations: {}
),
a!richTextDisplayField(
label: "Rich Text",
labelPosition: "COLLAPSED",
value: {
a!richTextIcon(
icon: "times",
link: a!dynamicLink(
saveInto: {
a!save(
ri!AS_LeaveDetails,
remove(ri!AS_LeaveDetails, fv!index)
)
}
),
linkStyle: "STANDALONE",
color: "NEGATIVE"
)
}
)
}
)
)
},
selectionSaveInto: {},
addRowLink: a!dynamicLink(
label: "Add new Employee Record",
saveInto: a!save(
ri!AS_LeaveDetails,
append(ri!AS_LeaveDetails, {local!Leave})
),
showWhen: if(
count(ri!AS_LeaveDetails)>=4,
false, true
)
),
validations: {},
shadeAlternateRows: true,
borderStyle: "STANDARD"
),
a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Submit",
icon: "check",
submit: true(),
size: "STANDARD",
width: "MINIMIZE",
style: "NORMAL",
confirmMessage: "You have successfully added a record!!"
)
},
align: "START"
)
}
)

  Discussion posts and replies are publicly visible