The-Commit-Company / frappe-react-sdk

React hooks for Frappe
https://frappe-react.vercel.app
MIT License
107 stars 36 forks source link

Unable to retrieve child table data with parent doc type data when using useFrappeGetDocList #24

Closed Shanuka-98 closed 1 year ago

Shanuka-98 commented 1 year ago

I'm facing an issue while fetching child table data using the useFrappeGetDocList hook with the parent document type data.

Currently, I can only retrieve child table data using useFrappeGetDoc. However, in my case, I need to use filters, which require the useFrappeGetDocList hook.

Is there a way to retrieve associated child table data and parent data simultaneously using the useFrappeGetDocList hook?

nikkothari22 commented 1 year ago

Hi @Shanuka-98

The library uses the standard Frappe REST API for listing documents in useFrappeGetDocList. AFAIK, the API does not allow joins between parent and child doctypes.

What we do and recommend you to do as well is to create a custom GET API in your app and then use useFrappeGetCall to fetch the data.

Shanuka-98 commented 1 year ago

Hi @nikkothari22,

Thank you for sharing that information! It's helpful to know that the Frappe REST API does not support joins between parent and child doctypes in the useFrappeGetDocList hook.

I appreciate your recommendation, Thanks