like-gold
like-gold2y ago

Pass a field from a foreign table which is in an array relationship to the filter in useList hook ?

const query = useList<IOrganization>({ resource: "organizations", metaData: { fields: ["id", { organization_units: ["id", "active"] }], }, config: { filters: [ { field: "organization_units.active", operator: "eq", value: true, }, ], }, }); here organization_units table is in foreign relationship with organization table. I need to access the active field of the organization_units table.
14 Replies
like-gold
like-gold2y ago
This is not able to fetch the "organization_units.active" I need to fetch only those records which has active true in the organization_units table
other-emerald
other-emerald2y ago
Hey @coops8 Which data provider you're using?
like-gold
like-gold2y ago
Hasura @aliemirs ??
other-emerald
other-emerald2y ago
Hey @coops8 checking the issue now 🙏
Omer
Omer2y ago
Hey @rehan1 , Any idea about this question?
absent-sapphire
absent-sapphire2y ago
even am not able to resolve this issue and i didnt get any reply
Omer
Omer2y ago
cool, let's try to solve it now. 1. Can you share the Raw GraphQL query running in Hasura? 2. Could you share the metaData object you sent and the GraphQL query that appears in your Network tab? So we can solve the problem by looking at the difference between the two.
like-gold
like-gold2y ago
1. query MyQuery { organizations(where: {organization_units: {active: {_eq: true}}, id: {_eq: "b2752fe2-600d-4152-9c5c-355f335e5493"}}) { active about_us organization_units { active center_name     }   } } 2. {,…} query: "query ($limit: Int, $offset: Int, $where: organizations_bool_exp) { organizations (limit: $limit, offset: $offset, where: $where) { id, organization_units { id, active }, users { id, active } } organizations_aggregate (where: $where) { aggregate { count } } }" variables: {limit: 10, offset: 0,…} limit: 10 offset: 0 where: {_and: [{organization_units: {active: {_eq: true}}}]} _and: [{organization_units: {active: {_eq: true}}}] 0: {organization_units: {active: {_eq: true}}} organization_units: {active: {_eq: true}} active:{_eq: true} _eq: true 2nd one is the payload from the network tab
Omer
Omer2y ago
Could you share a screenshot of your network tab?
like-gold
like-gold2y ago
No description
Omer
Omer2y ago
Different filters are applied according to the raw graphql query. For example users Could you please share the same query? Don't forget to share the metaData as well
absent-sapphire
absent-sapphire2y ago
filtering is working in nhost dataprovider but not in hasura dataprovider "@pankod/refine-core": "^3.90.0", "@pankod/refine-hasura": "^4.15.0",
Omer
Omer2y ago
I understand. @rehan1 , you must provide us with all the information so that we can resolve this issue. If something is not working, there can be dozens or even hundreds of reasons. If you like Refine and it makes your job easier, please help us to make this support sustainable and ask your questions as descriptive as possible. Unfortunately, "x is not working" does not contain enough information for us. Thank you very much for your understanding and attention 🎯
absent-sapphire
absent-sapphire2y ago
okay no issues