Using a Data Type for Lookup Function throws error, Invalid index

I have a data type for a SQL view TOS_CMS_VW_ClergyTitleStatusTypeDSE.  It contains fields describing various clergy members.  I want Clergy Id and Clergy Full Name in a lookup on an interface.  ClergyID is an integer and ClergyFullName is a text field.

I created a constant for the data type and I am not trying to create a expression to pull the two fields I want for the dropdown, ClergyID and ClergyFullName.

a!queryEntity(
  entity: cons!TOS_CMS_VW_ClergyTitleStatusTypeDSE,
  query: a!query(
    selection: {
      a!querySelection(columns: a!queryColumn(cons!TOS_CMS_VW_ClergyTitleStatusTypeDSE.clergyId)),
      a!qyerySelection(columns: a!queryColumn(cons!TOS_CMS_VW_ClergyTitleStatusTypeDSE.clergyfullname))
    },
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 500,
      sort: a!sortInfo(
        field: cons!TOS_CMS_VW_ClergyTitleStatusTypeDSE.clergyfullname,
      ascending: true()
      ),
    )
  )
)

This throws an error "Expression evaluation error at function a!queryColumn [line 5]: Invalid index: Cannot index property 'clergyId' of type Text into type Data Store Entity" even though clergyId is an integer.  

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hello Chris,

    The error is occurring due to an incorrect approach in retrieving the columns. Here's your provided sample code:

    a!queryEntity(
      entity: cons!TOS_CMS_VW_ClergyTitleStatusTypeDSE,
      query: a!query(
        selection: a!querySelection(
          columns: {
            a!queryColumn(field: "clergyId"),
            a!queryColumn(field: "clergyfullname")
          }
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 500,
          sort: a!sortInfo(
            field: "clergyfullname",
            ascending: true()
          )
        )
      )
    )

    To rectify this, you should utilize the a!queryColumn() function to pass a list of columns (which are CDT field names) within a single query selection function. Moreover, when invoking the field/column within the query entity function, remember to refer to it using the CDT field name.

    For further information, refer to https://docs.appian.com/suite/help/23.3/Query_Recipes.html#recipes-querying-entities

    Hope this helps!

Reply
  • 0
    Certified Lead Developer

    Hello Chris,

    The error is occurring due to an incorrect approach in retrieving the columns. Here's your provided sample code:

    a!queryEntity(
      entity: cons!TOS_CMS_VW_ClergyTitleStatusTypeDSE,
      query: a!query(
        selection: a!querySelection(
          columns: {
            a!queryColumn(field: "clergyId"),
            a!queryColumn(field: "clergyfullname")
          }
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 500,
          sort: a!sortInfo(
            field: "clergyfullname",
            ascending: true()
          )
        )
      )
    )

    To rectify this, you should utilize the a!queryColumn() function to pass a list of columns (which are CDT field names) within a single query selection function. Moreover, when invoking the field/column within the query entity function, remember to refer to it using the CDT field name.

    For further information, refer to https://docs.appian.com/suite/help/23.3/Query_Recipes.html#recipes-querying-entities

    Hope this helps!

Children
No Data