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
The error message is pretty clear. Line 88:
value: calworkhours(datetime(fv!item.From_Date),
suggests that the value fv!item.From_Date isn't providing the correct value(s) for the input to the datetime() function.
Did you mean to use fn!datetime() ratehr than fn!todatetime() ??
I have created rule inputs: From_Date and To_Date so i have given fv!item.From_Date
i wanted to calculate number of hours
calworkhours() simply takes a date range so you could code as:
calworkhours(fv!item.From_Date , ri!item.To_Date)
Okay Thank You