Skip to main content
January 12, 2021
Question

Turning query results into array

  • January 12, 2021
  • 4 replies
  • 0 views

Dear all,

I need to turn the results of the below query into an array including all "submissionunit"s to further use the wherecontains() formula on that.

Could anybody tell me which function to use to create an array in that case?

local!datasubset2: a!queryEntity(
      entity: cons!MR_ABGABE_DSE,
      query: a!query(
        selection: "submissionunit",
        filter: a!queryFilter(
          field: "submissionperiod",
          operator: "=",
          value: local!period
        ),
        pagingInfo: local!pagingInfo2
      ),
      fetchTotalCount: false
    )

Thank you very much in advance!

Chris

    4 replies

    danny.verb
    January 12, 2021

    a!queryEntity will return a datasubset. You can index into datasubset using the field 'data', for example 'local!datasubset2.data' and this will return a list of dictionary. Appian dictionaries can be sliced, this means you can also index into a specific field to get a list of data for that field. For example, 'local!datasubset2.data.submissionunit'. However, since indexing with dot notation might break if the field does not exist, I recommend using the index function. 'index(local!datasubset2.data, "submissionunit", {})'

    May 26, 2022

    Hi ,

    I actually wanted to convert the record query output in map format like (Key,value)

    I am learning Appian and cannot find any forums that helps.

    Can anybody help in this case?

    Thanks in advance,
    Tanuj

    manishk0011
    May 26, 2022

    As Denny said get your data in to dictinonary and then cast it to map  more details at-  docs.appian.com/.../fnc_system_map.html