Invalid index: Cannot index property 'asDate' of type Text into null value of type. How to solve that?

a!localVariables(
local!data: a!localVariables(
local!dateList: todate(
union(
index(ri!taskProductionList, "asDate"),
index(ri!taskProductionList, "asDate")
)
),
a!forEach(
local!dateList,
a!localVariables(
local!dateData: index(
ri!taskProductionList,
wherecontains(
fv!item,
todate(
index(ri!taskProductionList, "asDate", {})
)
),
{}
),
local!taskProduction: if(
and(rule!INO_isBlank(local!dateData)),
"-",
(
(
todecimal(local!dateData.taskId) / todecimal(local!dateData.taskDuration)
) * 100
),

),
if(
rule!INO_isBlank(local!dateData),
{
taskId: 0,
taskProduction: 0,
taskName: "-",
asDate: "-"
},
{
asDate: fv!item,
taskId: if(rule!INO_isBlank(local!dateData.taskId),0,local!dateData.taskId),
taskName: if(rule!INO_isBlank(local!dateData.taskName),0,local!dateData.taskName),
taskProduction: local!taskProduction,

}
)
)
)
),
{
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: a!richTextItem(
text: "Selected Task: " & ri!selectedGroup,
size: "MEDIUM",
color: "SECONDARY"
)
),
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextIcon(
icon: "arrow-circle-left",
color: "ACCENT",
link: a!dynamicLink(value: null, saveInto: ri!selectedGroup),
linkStyle: "STANDALONE"
),
a!richTextItem(
text: " Back",
color: "ACCENT",
link: a!dynamicLink(value: null, saveInto: ri!selectedGroup),
linkStyle: "STANDALONE"
),

}
),
a!gridField(
labelPosition: "COLLAPSED",
borderStyle: "LIGHT",
initialSorts: { a!sortInfo(field: "asDate") },
data: local!data,
columns: {
a!gridColumn(
label: "Event Date",
sortField: "asDate",
value: a!richTextDisplayField(
value: a!richTextItem(text: fv!row.asDate)
)
),
a!gridColumn(
label: "Count of Tasks",
sortField: "taskId",
align: "END",
value: fv!row.taskId
),
/*a!gridColumn(
label: "Production Rate (tasks/hour)",
sortField: "taskProduction",
align: "END",
value: fixed(fv!row.taskProduction, 2, true)
)*/
}
),
/*a!textField(value:ri!taskProductionList ),
a!textField(value: todate(
union(
index(ri!taskProductionList, "asDate"),
index(ri!taskProductionList, "asDate")
)
) )*/
}
)

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to moulikadas

    The error message indicates you're attempting to access the property of a CDT or Dictionary when the property does not currently exist in that name in that instance of the dictionary or CDT.  For a Rule Input of "list of CDT" type, this is usually seen in the interface editor when the "test" value is loaded with a NULL value - i suspect if you try setting it as an empty set {}, it might work.

    Also, as Harshit mentioned, you should be using a 3rd parameter in your index() function (and IMHO you should be using property() when getting a property, and use index() when you're getting the index of an array, though that isn't what's making the difference here).  Using the "default" parameter allows the code to at least work otherwise when it encounters a missing property, and you can continue debugging from there.

Children