Skip to main content
Inspiring
Nov 15, 2021 9:42 PM UTC
Solved

Return A QueryEntity With All Rows

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?

Participating Frequently
Nov 15, 2021 10:01 PM UTC

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

Participating Frequently
Nov 15, 2021 10:01 PM UTC

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
Inspiring
Nov 15, 2021 10:09 PM UTC

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