Question
Expression Error on User Interface - Length of input arrays must equal length of CDT/Dictionary array
Expression evaluation error [evaluation ID = a667e:8b65e] in rule
'ntd_adminreportingdashboardmonthlycompliance' (called by
rule 'ntd_adminreportingdashboard') at function a!forEach [line
42]: Error in a!forEach() expression during iteration 5: Expression
evaluation error at function 'updatecdt' [line 44]: Length of input
arrays must equal length of CDT/Dictionary array
Interface Code:
if(
and(ri!isShowMonthlyCompliance = false,rule!GLB_isNotEmpty(ri!selectedMonthAndYear)),
a!localVariables(
local!searchVanpool,
local!searchCoordinator,
local!searchEmployer,
local!searchOperationsContact,
local!complianceData: a!refreshVariable(
refreshOnVarChange: {
ri!savedTripDataCounter,
ri!selectedMonthAndYear
},
value: rule!INT_TRP_getTransitMonthlyComplianceStats(
transitAgencyCode: index(ri!selectedMonthAndYear,"transitAgencyCode",{}),
month: index(ri!selectedMonthAndYear, "month", {}),
year: index(ri!selectedMonthAndYear, "year", {})
)
),
local!isComplainceDataPresent: and(
local!complianceData.result.statusCode = 200,
rule!GLB_isNotEmpty(index(local!complianceData.result.body,"vanpoolId",null))
),
local!complianceDataReport: cast(
typeof({'type!{urn:com:rideshare:trp}NTD_Admin_Reporting_Monthy_Complaince_Report'()}),
local!complianceData.result.body
),
if(
local!complianceData.result.statusCode <> 200,
a!boxLayout(
label: "Monthly Compliance",
contents: {
rule!GLB_displayIntegerationErrorDetails(response: local!complianceData),
a!paragraphField(value : local!complianceData)
},
style: "#f9cb9c"
),
a!localVariables(
local!viewVanpoolEmployerAndContacts: rule!NTD_getViewVanpoolEmployerAndContacts(
vanpoolId: local!complianceDataReport.vanpoolId,
pagingInfo: a!pagingInfo(1, - 1)
),
local!updatecomplianceDataReport: a!forEach(
local!complianceDataReport,
updatecdt(
cdt: fv!item,
fieldsAndValues: {
employerName: index(
index(
local!viewVanpoolEmployerAndContacts,
wherecontains(fv!item.vanpoolId,touniformstring(index(local!viewVanpoolEmployerAndContacts,"vanpool_id",""))),
null
),
"employer_name",
""
),
employerCode: index(
index(
local!viewVanpoolEmployerAndContacts,
wherecontains(fv!item.vanpoolId,touniformstring(index(local!viewVanpoolEmployerAndContacts,"vanpool_id",""))),
null
),
"employer_code",
""
),
operationsContact: index(
index(
local!viewVanpoolEmployerAndContacts,
wherecontains(fv!item.vanpoolId,touniformstring(index(local!viewVanpoolEmployerAndContacts,"vanpool_id",""))),
null
),"operations_contact", "" ),
coordinatorEmail: index(
index(
local!viewVanpoolEmployerAndContacts,
wherecontains(fv!item.vanpoolId,
touniformstring(index(local!viewVanpoolEmployerAndContacts,"vanpool_id",""))
),
null
), "coordinator_email",""),
coordinatorId: index(
index(
local!viewVanpoolEmployerAndContacts,
wherecontains(fv!item.vanpoolId,
touniformstring(index(local!viewVanpoolEmployerAndContacts,"vanpool_id",""))
),
null
), "coordinator_id",""),
}
)
),
local!operationsContactValues: union(
local!updatecomplianceDataReport.operationsContact,
local!updatecomplianceDataReport.operationsContact
),
local!employerNameValues: union(
local!updatecomplianceDataReport.employerName,
local!updatecomplianceDataReport.employerName
),
local!filteredReportVanpool: if(
rule!APN_isBlank(local!searchVanpool),
local!updatecomplianceDataReport,
index(
local!updatecomplianceDataReport,
wherecontains(
local!searchVanpool,
touniformstring(
local!updatecomplianceDataReport.vanpoolId
)
),
{}
)
),
local!filteredReportOpsContact: if(
rule!APN_isBlank(local!searchOperationsContact),
local!filteredReportVanpool,
index(
local!filteredReportVanpool,
wherecontains(
local!searchOperationsContact,
touniformstring(
local!filteredReportVanpool.operationsContact
)
),
{}
)
),
local!filteredReportCoord: if(
rule!APN_isBlank(local!searchCoordinator),
local!filteredReportOpsContact,
index(
local!filteredReportOpsContact,
wherecontains(local!searchCoordinator,touniformstring(local!filteredReportOpsContact.coordinatorName)),
{}
)
),
local!filteredReportEmployer: if(
rule!APN_isBlank(local!searchEmployer),
local!filteredReportCoord,
index(
local!filteredReportCoord,
wherecontains(local!searchEmployer,touniformstring(local!filteredReportCoord.employerName)),
{}
)
),
local!exportUri: getdatasubsetdownloadlinkfromprocess(
processModelUuid: cons!NTD_EXPORT_ADMIN_REPORTING_MONTHLY_COMPLIANCE_REPORT_PROCESS_MODEL,
input: a!toJson(
{
a!map(
transitAgencyCode: ri!selectedMonthAndYear.transitAgencyCode,
month: ri!selectedMonthAndYear.month,
year: ri!selectedMonthAndYear.year,
coordinator :local!searchCoordinator,
employer :local!searchEmployer ,
operationsContact:local!searchOperationsContact ,
vanpool:local!searchVanpool
)
}
)
),
a!boxLayout(
label: "Monthly Compliance",
contents: {
a!boxLayout(
label: "Filters",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!dropdownField(
label: "Vanpool ID",
placeholder: cons!GLB_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: local!complianceDataReport.vanpoolId,
choiceValues: local!complianceDataReport.vanpoolId,
value: local!searchVanpool,
saveInto: local!searchVanpool,
searchDisplay: "ON"
)
}
),
a!columnLayout(
contents: {
a!dropdownField(
label: "Coordinator Name",
placeholder: cons!GLB_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: union(local!updatecomplianceDataReport.coordinatorName,
local!updatecomplianceDataReport.coordinatorName),
choiceValues: union(local!updatecomplianceDataReport.coordinatorName,
local!updatecomplianceDataReport.coordinatorName),
value: local!searchCoordinator,
saveInto: local!searchCoordinator,
searchDisplay: "ON"
)
}
),
a!columnLayout(
contents: {
a!dropdownField(
label: "Employer Name",
placeholder: cons!GLB_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: local!employerNameValues,
choiceValues: local!employerNameValues,
value: local!searchEmployer,
saveInto: local!searchEmployer,
searchDisplay: "ON"
)
}
),
a!columnLayout(
contents: {
a!dropdownField(
label: "Operations Contact",
placeholder: cons!GLB_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: local!operationsContactValues,
choiceValues: local!operationsContactValues,
value: local!searchOperationsContact,
saveInto: local!searchOperationsContact,
searchDisplay: "ON"
)
}
),
a!columnLayout(contents: {})
}
)
},
isCollapsible: true(),
isInitiallyCollapsed: true()
),
a!gridField(
label: "",
labelPosition: "ABOVE",
emptyGridMessage: "There are no vanpools for the selected month and year.",
data: local!filteredReportEmployer,
columns: {
a!gridColumn(
label: "Vanpool ID",
sortfield: "vanpoolId",
value: fv!row.vanpoolId
),
a!gridColumn(
label: "Coordinator",
sortField: "coordinatorName",
value: fv!row.coordinatorName
),
a!gridColumn(
label: "Employer",
sortField: "employerName",
value: fv!row.employerName
),
a!gridColumn(
label: "Operations Contact",
sortField: "operationsContact",
value: fv!row.operationsContact
),
a!gridColumn(
label: "Occupancy %",
sortField: "occupancy",
value: fv!row.occupancy
),
a!gridColumn(
label: "Capacity",
sortField: "capacity",
value: fv!row.capacity
),
a!gridColumn(
label: "UPT",
sortField: "upt",
value: rule!GLB_formatNumberWithCommasAtThousands(fv!row.upt)
),
a!gridColumn(
label: "VRM",
sortField: "vrm",
value: rule!GLB_formatNumberWithCommasAtThousands(fv!row.vrm)
),
a!gridColumn(
label: "VRH",
sortField: "vrh",
value: fv!row.vrh
),
a!gridColumn(
label: "PMT",
sortField: "pmt",
value: rule!GLB_formatNumberWithCommasAtThousands(fv!row.pmt)
),
a!gridColumn(
label: "Days Run",
sortField: "daysOperated",
value: fv!row.daysOperated
),
a!gridColumn(
label: "Days Planned",
sortField: "scheduledDays",
value: fv!row.scheduledDays
),
a!gridColumn(
label: "Report Completion %",
sortField: "reportingCompletion",
value: fv!row.reportingCompletion
),
a!gridColumn(
label: "Fuel Gallons",
sortField: "fuelGallons",
value: fv!row.fuelGallons
),
a!gridColumn(
label: "Fuel Cost",
sortField: "fuelCost",
value: rule!APN_dollar(fv!row.fuelCost, true)
),
a!gridColumn(
label: "Exceptions",
sortField: "exceptions",
value: fv!row.exceptions
)
},
initialSorts: {
a!sortInfo(field: "vanpool_id", ascending: false)
},
selectable: true,
selectionStyle: "ROW_HIGHLIGHT",
selectionValue: if(
rule!APN_isEmpty(ri!selectedVanpool),
null,
wherecontains(
ri!selectedVanpool.vanpoolId,
a!flatten(
index(
local!complianceData.result.body,
"vanpoolId",
null
)
)
)
),
selectionSaveInto: {
a!save(ri!selectedVanpool, null),
a!save(ri!selectedVanpool, fv!selectedRows),
if(
rule!GLB_isNotEmpty(ri!selectedVanpool),
a!save(ri!isShowVanpoolHistoricalStats, false),
{}
),
a!save(ri!isShowMonthlyCompliance, false)
},
spacing: "DENSE"
),
a!linkField(
labelPosition: "COLLAPSED",
links: {
a!safeLink(
label: "Click Here to Export This Report",
uri: local!exportUri
)
},
showWhen: or(
rule!APN_isEmpty(local!exportUri),
local!isComplainceDataPresent
)
)
},
showWhen: and(
ri!isShowMonthlyCompliance = false,
rule!GLB_isNotEmpty(ri!selectedMonthAndYear),
rule!GLB_isNotEmpty(local!complianceData)
),
style: "#f9cb9c",
isCollapsible: true,
marginBelow: "STANDARD"
)
)
)
),
{}
)
