How to use pick on an array

:bullseye: What is your goal?

I would like to extract several keys from an array with a built-in function, like a map(), but not only of one keys but several

:thinking: What is the problem & what have you tried?

I am trying pick() but always get empty values. It’s a very simple array of texts

Yeah I think pick() only works on collections and not on arrays, Im not 100% on this though.

Did you try with get() or a separate map() for each key? Can you share the array as well?

Hey @Doudoubcn !

If you want several fields from each item in an array, pick() won’t work the same way map() does. pick() expects a collection and specific keys, and if the structure doesn’t match exactly it will return empty values.

The usual approach in Make is to use map() and return a new structure that contains the fields you want.

For example, if each item has fields like name, email, and company, you would map the array and build a new object with those keys. That way each element of the result contains the selected fields instead of trying to extract them separately.

If pick() is returning empty values, it usually means the path to the keys doesn’t match the actual structure of the items in the array. It helps to check one bundle and confirm the exact field names and nesting.

If you can share a small example of the array structure, it will be easier to suggest the exact expression.

Dr. Tanvi Sachar
Monday Certified Partner, Tuesday Wizard

thanks !! to rebuilt i can merge the different map() arrays right?

@Doudoubcn

Yes, you can merge them, but rebuilding the structure with a single map is usually easier.

If you run several map functions you will get separate arrays, one per field. Those arrays only contain values, so merging them later can be tricky because the item relationships are lost.

A more reliable approach is to use one map and return a small collection containing all the fields you need for each item. That way every element in the result already contains the grouped values.

If you are working with separate arrays already, you would need to combine them carefully to keep the same index alignment. Otherwise the values can end up mismatched.

If you share a quick example of the original array and the fields you want to keep, it is easier to show the exact expression.

Dr. Tanvi Sachar
Monday Certified Partner, Tuesday Wizard