Converting a map of objects to an array of CDTs

Hi

I've recently been experimenting with with Grid components. I'm currently using the read-only grid and it's `fv!selectedRows` variable to pull out the full object of data from each object selected.

`fv!selectedRows` returns a map of objects, but I would like to have an array of CDTs so that I can then pass it onto my process model.

I wondered what would be the most efficient way to cast the map to an array of CDTs?

Thanks in advance!

Note: I am using 19.03

  Discussion posts and replies are publicly visible

  • I'm currently doing the following:

    a!save(
      target: local!SelectedRows,
      value: save!value
    ),
    a!save(
      target: local!SelectedSites,
      value: append(local!SelectedSites, fv!selectedRows)
    ),
    a!save(
      target: local!SelectedSites,
      value: difference(local!SelectedSites, fv!deselectedRows)
    ),
    a!save(
      target: ri!SelectedSites,
      value: a!forEach(
        items: local!SelectedSites,
        expression: cast('type!Site', fv!item)
      )
    )

  • +1
    Appian Employee
    in reply to dextermb

    That should work, but you can also eliminate one of the saves if you directly cast the data in your append and difference functions above like this:

    selectionSaveInto: {
      local!selection,
      a!save(
        ri!case, append(
          ri!case, cast(
            'type!{urn:com:appian:types:PDL}PDL_Client?list',
            fv!selectedRows
          )
        )
      ),
      a!save(
        ri!case, 
        difference(
          ri!case, 
          cast(
            'type!{urn:com:appian:types:PDL}PDL_Client?list',
            fv!deselectedRows
          )
        )
      )
    }