frappe.exceptions.DataError: Field not permitted in query: drug_name
Is what I’m trying to do at all even possible? Any ideas? If it’s not possible please let me know so I can stop wasting my time trying to figure this out. Thank you!
What you’re calling a “nested array” is more often called a child doc in Frappe lingo. You can filter by child doctypes by sending a four value array, something like:
I’m a bit confused about what you’re presenting here, though. What is the parent doctype of “blablabla”, and what is the child doctype with the values like “dosage”, “period”, etc.? For what I’ve described here, you want to poll the Parent Doctype rest endpoint but then filter by the child. The four part array should let you do that.
Nothing to apologize for, but I was worried you were also maybe polling the wrong endpoint. If it’s working, that’s proof you’re not! Glad it’s working. I’ll update the documentation to make this clearer.
No it’s the correct one. Thanks alot! I have another question if you might be able to help me. Is there a way to group the results based on the filters in the link? Like adding Group by “drug_name” in the link? So if there’s several results with the same drug I just want one of them to show. Thank you very much!
Good question. You might be able to get sorting based on child documents to work, but I don’t think you can do anything more complicated than that. REST APIs are meant to be pretty simple.
If you’re looking to do a bit more processing, you might consider writing a python method and then calling it via RPC. The easiest way to do this probably is via Server Scripts. With that, you’ll have a much broader array of possibilities available to you, and the results can be returned however you prefer.