Hello everyone, I’m having some trouble to manage to filter my records can anyone possibly help me out?
So my record has a property named accommodations, that is an array of objects that have the properties:
- housing
- roomType
- meal
- bathroom
Like the example bellow:
“id”: 999,
“country”: “Estados Unidos”,
“city”: “Fort Lauderdale”,
“programType”: “Curso de Idioma”,
“language”: “Inglês”,
“courseLoad”: “30 Aulas Semanais”,
“hour”: “Integral”,
“title”: “Intensive English”,
“accommodations”: [
{
“id”: 905,
“provider”: “Homestay”,
“name”: “Homestay”,
“housing”: “Casa de Família”,
“roomType”: “Individual”,
“meal”: "Café da Manhã ",
“bathroom”: “Externo Compartilhado”,
},
{
“id”: 906,
“provider”: “Homestay”,
“name”: “Homestay”,
“housing”: “Casa de Família”,
“roomType”: “Duplo”,
“meal”: "Café da Manhã ",
“bathroom”: “Externo Compartilhado”,
},
{
“id”: 907,
“provider”: “La Quinta”,
“name”: “La Quinta”,
“housing”: “Residência Estudantil”,
“roomType”: “Individual”,
“meal”: "Sem Refeição ",
“bathroom”: “Privativo”,
},
{
“id”: 908,
“provider”: “La Quinta”,
“name”: “La Quinta”,
“housing”: “Residência Estudantil”,
“roomType”: “Duplo”,
“meal”: “Sem Refeição”,
“bathroom”: “Internao Compartilhado”,
}
],
I’m able to create the filter for those properties, but when I filtered it, it will filter as an “OR” condition.
So for example, if I set the filter for housing as “Residência Estudantil” it will show all the records that has the accommodation.housing with “Residência Estudantil” but when I add a second filter, for meal for example with the value Café da Manhã it will still show this record because it is searching for any object inside the array of objects that has the meal field with “Café da Manhã” OR the housing field with the value “Residência Estudantil” and I need to only display the records that has meal with “Café da Manhã” AND housing with “Residência Estudantil” at the same object in the array.
I’m sorry I’m could not explain that perfect what I’m trying to do, hope it makes sense.
If someone could help me out, would appreciate a lot.
Thanks