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
Why don't you have a 3rd parameter in your index() function?
3rd parameter is a default and it's not required all time. Could you plz tell me why this error occurred?
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.
So, plz suggest how to write the code.
Replace the local variable definition for local!dateList with this cleaned-up code:
local!dateList: todate( union( property(ri!taskProductionList, "asDate", {}), property(ri!taskProductionList, "asDate", {}) ) ),
Beyond that, I'm unable to tell much more until you edit the original post to move your code into a code box (using a fresh copy so indentation is preserved like you'd see in the interface editor) so it's actually readable
It's annoying when you have to scroll all the way down to read new replies.
Maybe you need to focus more on the documentation. If you don't add the 3rd parameter specially when it is being used, then you end up having such kind of errors.