Skip to main content
November 15, 2021
Solved

Return A QueryEntity With All Rows

  • November 15, 2021
  • 2 replies
  • 0 views

Hello, I'm using the following to return all user rows, but I'm only getting one back:

local!usersAll : cast('type!{urn:com:appian:types}AL_Users' 
    , a!queryEntity(
      entity:cons!AL_USERS,
      query:a!query(
        pagingInfo:a!pagingInfo(
          startIndex:1,
          batchSize:-1,
          sort:a!sortInfo(
            field:"name",
            ascending:true
          )
        )

      )
    ).data)

I'm using this inside a local variable in a interface. Is there a limitation to this approach? Do I need to do it somehow else? In a Web API, this works and returns all, but not here, is it something with usage inside an interface?

Best answer by hrishikeshd997

While casting you have to cast it as type of list -

local!usersAll : cast('type!{urn:com:appian:types}AL_Users?list' 
    , a!queryEntity(
      entity:cons!AL_USERS,
      query:a!query(
        pagingInfo:a!pagingInfo(
          startIndex:1,
          batchSize:-1,
          sort:a!sortInfo(
            field:"name",
            ascending:true
          )
        )

      )
    ).data)

2 replies

November 15, 2021

While casting you have to cast it as type of list -

local!usersAll : cast('type!{urn:com:appian:types}AL_Users?list' 
    , a!queryEntity(
      entity:cons!AL_USERS,
      query:a!query(
        pagingInfo:a!pagingInfo(
          startIndex:1,
          batchSize:-1,
          sort:a!sortInfo(
            field:"name",
            ascending:true
          )
        )

      )
    ).data)

alexl0007Author
November 15, 2021

[mention:9f22048bf7344a7b9a9ae1f3717f4aab:e9ed411860ed4f2ba0265705b8793d05] Yes that was what I was missing. Thank you for the answer.