Help using Object.select() in UDF

Hi all,

I have the following UDF:

@role(admin)
function findCountryOptions() { 
  (Calendar.findCountries() {
    cal_country
  }).distinct()
}

Which returns the following:

{
  data: [
    {
      cal_country: "Australia"
    }
  ]
}

How would I use Object.select() or another built-in function to return a response like:

[
  "Australia"
]

You’re on the right track. You’ll first need to use map() to iterate through each object in the Set. This should work:

@role(admin)
function findCountryOptions() { 
  (Calendar.findCountries() {
    cal_country
  }).distinct()
  .map(obj => {
    Object.select(obj, ['cal_country'])
  }).toArray()
}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.