for the following contents of data
object:
0
:
{pppId: '005618-00', eppo: 'FAUSY', crop: 'Rotbuche'}
1
:
{pppId: '005618-00', eppo: 'PSTME', crop: 'Douglasie'}
2
:
{pppId: '005618-00', eppo: 'QUESS', crop: 'Eiche'}
3
:
{pppId: '005618-00', eppo: 'YLAGL', crop: 'Langholzpolter'}
4
:
{pppId: '005618-00', eppo: 'PIEPU', crop: 'Blaufichte'}
5
:
{pppId: '005618-00', eppo: 'ALUSS', crop: 'Erle'}
6
:
{pppId: '005618-00', eppo: 'POPSS', crop: 'Pappel'}
7
:
{pppId: '005618-00', eppo: 'YLAGE', crop: 'Einzelstämme'}
8
:
{pppId: '005618-00', eppo: 'NNNZG', crop: 'Ziergehölze'}
9
:
{pppId: '005618-00', eppo: 'ACRCA', crop: 'Acer campestre'}
10
:
{pppId: '005618-00', eppo: 'YLAGS', crop: 'Schichtholzpolter'}
11
:
{pppId: '005618-00', eppo: 'PIUSS', crop: 'Kiefer'}
12
:
{pppId: '005618-00', eppo: 'ABINO', crop: 'Nordmann-Tanne'}
13
:
{pppId: '005618-00', eppo: 'CIPBE', crop: 'Carpinus betulus'}
14
:
{pppId: '005618-00', eppo: 'LAXSS', crop: 'Lärche'}
i want to filter out the contents of the object data
by the crop
name Eiche
and Kiefer
i want to make data
contains only the 2nd and the 11th entries. in other words, i want data
to contain:
{pppId: '005618-00', eppo: 'QUESS', crop: 'Eiche'}
{pppId: '005618-00', eppo: 'PIUSS', crop: 'Kiefer'}
how can i achieve that please
2
Answers
You can try the following way:
Use
Set
to filter the needed crops:An one-liner: