permanent filter not getting applied idf its nested
this is useTAble
const { tableProps, setFilters } = useTable({
resource: "packages",
metaData: {
fields: [
"id",
"name",
"cost",
"active",
{ packages_services: ["id", { service: ["active"] }] },
],
},
permanentFilter: [
{
field: "active",
operator: "eq",
value: true,
},
{
field: "packages_services.service.active",
operator: "eq",
value: true,
},
],
});
this is the data i want to filter service which is active
{
"packages": [
{
"id": "9442e083-c2b1-46bf-bdbc-33328f6efcbc",
"name": "pack1",
"cost": 1000,
"active": true,
"packages_services": [
{
"id": "83679e40-bad5-4ae1-bab9-18fcb92cf947",
"service": {
"active": true
}
},
{
"id": "3ef55ddb-8529-4557-8eff-46650252039d",
"service": {
"active": false
}
}
]
}
],
}
8 Replies
correct-apricot•2y ago
can u please help me with this
like-gold•2y ago
Please be patient. We try to reply as early as possible.
permanentFilter
works as expected in our examples.
There is probably an error in the field names. I suggest you to check the payload from the network.correct-apricot•2y ago
{
"limit": 10,
"offset": 0,
"order_by": {},
"where": {
"_and": [
{
"packages_services": {
"service": {
"active": {
"_eq": true
}
}
}
},
{
"active": {
"_eq": true
}
}
]
}
}
field names are correct its not filtering the service based on active
this is data am recieving {
"packages": [
{
"id": "9442e083-c2b1-46bf-bdbc-33328f6efcbc",
"name": "pack1",
"cost": 1000,
"active": true,
"packages_services": [
{
"id": "83679e40-bad5-4ae1-bab9-18fcb92cf947",
"service": {
"name": "General Medicine",
"active": true
}
},
{
"id": "3ef55ddb-8529-4557-8eff-46650252039d",
"service": {
"name": "HSG",
"active": false
}
}
]
}
],
"packages_aggregate": {
"aggregate": {
"count": 1
}
}
}
like-gold•2y ago
which data provider are you using?
correct-apricot•2y ago
hasura
like-gold•2y ago
okay. i will investigate and back to you as soon as possible
correct-apricot•2y ago
if its object relation ship nested filtering is working fine
actually this is array relationship
like-gold•2y ago
sorry @rehan1. I check hasura docs and generated query and everything seems fine but i couldn't reproduce the issue.
if your API is public and you give me connection string i'm happy to try to debug more
or if you give me reproduced code with link. im happy to help