How to sort a CDT from another CDT source?

Certified Senior Developer

Hi,

I've already had to sort a CDT and I could use this code below very useful.

However, how would you do to sort a CDT from another CDT source (without Query the DB)?

Example : I need to sort the cdt1 on the cdtDocs.order field

cdt1
  - id
  - ref
  - label
  - idDoc (references the cdtDocs.id field)


cdtDocs
  - id
  - order
  - label

cast(
  typeof(local!cdt),
  todatasubset(
    local!cdt,
    a!pagingInfo(
      startIndex: 1,
      batchSize: -1,
      sort: a!sortInfo(
        field: local!field,
        ascending: local!ascending
      )
    )
  ).data
)

  Discussion posts and replies are publicly visible