ambitious-aqua
ambitious-aqua4y ago

setFilters for json object

is there a way to apply nested filters for json b object retuning from usetable , using setFilters
9 Replies
ambitious-aqua
ambitious-aquaOP4y ago
const {tableProps,filters,setFilters} = useTable({ resource:"orders", metaData:{ fields:[ "patient_name", "uid", " order_status", "order_info", {provider:["solution","name"]}, {order_items:["provider_catalogue_id"]}, {payments:["order_id","payment_status"]}
] }, }) so here in meta data order_info field is json object setFilters([{ field:"order_info.type", operator:"eq", value:"booked" }],"merge") so i want to filter order_info . type
Omer
Omer4y ago
Hey @rehan1 👋, Is there an error you get?
ambitious-aqua
ambitious-aquaOP4y ago
no errors ... but it is filtering table to empty array
Omer
Omer4y ago
If this filter is working in Hasura. You can compare your GraphQL query with the query created by refine ⚡️
ambitious-aqua
ambitious-aquaOP4y ago
"message":"field "type" not found in type: 'jsonb_comparison_exp'"} throwing this error orders(where: {order_info: {_contains: {type: "somevalue"}}) this way we filter in hasura
Omer
Omer4y ago
Can you compare it with the query generated with refine?
ambitious-aqua
ambitious-aquaOP4y ago
order_info : {type: {_eq: "Physical"}} order_info:{type:{_eq:"somevalue"}} this query is generated with refine order_info:{type:{_eq:"somevalue"}} generated using refine order_info: {_contains: {type: "somevalue"}} using hasura this way
ambitious-aqua
ambitious-aquaOP4y ago
ok is this issue fixed in We've released @pankod/refine-hasura@4.15.0 🎉

Did you find this page helpful?