How to resolve "Invalid index: Cannot index property 'employee' of type Text into null value of type list" this error?

local!supervisorList: if(
    contains({ 3, 6 }, ri!selectedDashboard),
    index(
      /*a!isNotNullOrEmpty(tointeger(ri!reportingEmployeeList)),*/
      ri!reportingEmployeeList,
      wherecontains(
        cons!INO_DESIG_ID_SUPERVISOR,
        tointeger(
          index(
            ri!reportingEmployeeList,
            "designationId",
            0
          )
        )
      ),
      {}
    ),
    null
  ),
  local!supervisorHierarchyList: if(
    contains({ 3, 6 }, ri!selectedDashboard),
    a!forEach(
      items: local!supervisorList,
      expression: 'type!{urn:com:appian:types:INO}INO_employeeHierarchyHelper'(
        employee: fv!item,
        directReportEmployeeList: index(
          typeof(ri!reportingEmployeeList),
          wherecontains(
            index(local!supervisorList, "internalEmpId"),
            tointeger(
              index(
                ri!reportingEmployeeList,
                "currentReportingManagerId",
                0
              )
            )
          ),
          {}
        )
        /*index(
          local!supervisorList,
          wherecontains(
            /*fv!item.internalEmpId,*/
            /*index(ri!reportingEmployeeList, "internalEmpId"),
            tointeger(
              index(
                ri!reportingEmployeeList,
                "currentReportingManagerId",
                0
              )
            )
          ),
          {}
        )*/
      )
    ),
    null
  ),

Above is my code and below is the data CDT screenshot

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You get this error when you try to use the dot-notation to access a field in a data structure. But I do not see that in your code snippet.

    BTW, what is line 27 meant to do?

    BBTW, nested CDTs are not recommended.

  • If I without use typeof then also same error occurred. So how to resolve it. Please suggest.

    local!supervisorList: if(
        contains({ 3, 6 }, ri!selectedDashboard),
        index(
          /*a!isNotNullOrEmpty(tointeger(ri!reportingEmployeeList)),*/
          ri!reportingEmployeeList,
          wherecontains(
            cons!INO_DESIG_ID_SUPERVISOR,
            tointeger(
              index(
                ri!reportingEmployeeList,
                "designationId",
                0
              )
            )
          ),
          {}
        ),
        null
      ),
      local!supervisorHierarchyList: if(
        contains({ 3, 6 }, ri!selectedDashboard),
        a!forEach(
          items: local!supervisorList,
          expression: 'type!{urn:com:appian:types:INO}INO_employeeHierarchyHelper'(
            employee: fv!item,
            directReportEmployeeList: index(
              ri!reportingEmployeeList,
              wherecontains(
                index(local!supervisorList, "internalEmpId"),
                tointeger(
                  index(
                    ri!reportingEmployeeList,
                    "currentReportingManagerId",
                    0
                  )
                )
              ),
              {}
            )
            /*index(
              local!supervisorList,
              wherecontains(
                /*fv!item.internalEmpId,*/
                /*index(ri!reportingEmployeeList, "internalEmpId"),
                tointeger(
                  index(
                    ri!reportingEmployeeList,
                    "currentReportingManagerId",
                    0
                  )
                )
              ),
              {}
            )*/
          )
        ),
        null
      ),

  • 0
    Certified Lead Developer
    in reply to moulikadas

    Hm ....

    What I mean is that

    typeof(ri!reportingEmployeeList),

    returns the ID of the data type of that rule input. Trying to index() into this makes no sense for me. Help me understand what you are trying to do.

Reply Children
No Data