Hey Team,
I am trying to filter the customer id (received from the app dropdown) from Array 1 and use the filtered customer id to filter Array 2. Here is the sample JSON below. The expected output for customer id 1 is INFO1 & INFO4 from Array 2. Any help is appreciated.
Array 1:
[
{
"customer_id": "1",
"address": "Street1",
"city": "Dublin"
},
{
"customer_id": "2",
"address": "Street2",
"city": "San Jose"
},
{
"customer_id": "3",
"address": "Street3",
"city": "Dallas"
}
]
Array 2:
[
{
"customer_id": "1",
"validation_id":"INFO1"
},
{
"customer_id": "2",
"validation_id":"INFO2"
},
{
"customer_id": "3",
"validation_id":"INFO3"
},
{
"customer_id": "1",
"validation_id":"INFO4"
}
]
Hey saravanakumar84!
If we are using select and table to display those 2 different arrays filtering can be done with few steps.
Drag the select component and add your Array 1 to mapped value.
Add the table with the Array 2 value.
Using .filter() filter out customer_id's matching the selected value.
{{[
{
"customer_id": "1",
"validation_id":"INFO1"
},
{
"customer_id": "2",
"validation_id":"INFO2"
},
{
"customer_id": "3",
"validation_id":"INFO3"
},
{
"customer_id": "1",
"validation_id":"INFO4"
}
].filter(x=>x.customer_id==select1.value)}}
Hope this helps!
stefancvrkotic:
{{[
{
"customer_id": "1",
"validation_id":"INFO1"
},
{
"customer_id": "2",
"validation_id":"INFO2"
},
{
"customer_id": "3",
"validation_id":"INFO3"
},
{
"customer_id": "1",
"validation_id":"INFO4"
}
].filter(x=>x.customer_id==select1.value)}}
Thanks @stefancvrkotic . This option works well.