Insert to a list field on supabase
Hi, I have a list of text on a supabase table field. When I use auto generate for create page, the code is not support for a list field.
I have tried to use select props but it seems like it will select a list from another table. I just want to insert to the list with value from input. Can someone help me?
2 Replies
Hi @tandeptraiso1. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, I can guide you on how to handle relational data in refine.
In refine, you can handle relational data using the
useMany
hook and filter <Table>
by categories with the help of useSelect
. When using Supabase as your data provider, you can pass a select
value in the meta
object to perform relational database operations. For example, if you have a posts -> categories
relationship and you want to get the title
data from the categories
table and display it on the List page, you can do something like this:
In this example, useList
, useOne
, useMany
hooks are using Supabase select
property internally. So you can pass parameters to the Supbase select method using meta
property. Please note that the select
value in the meta
object is using Supabase select
property internally, which means you can use the same syntax as you would in a Supabase API call.
For more complex joins or queries, you might need to adjust the select
value accordingly. If you need more specific help, please provide more details about your data structure and the exact query you're trying to perform.
For more information, you can refer to the refine documentation (https://refine.dev/docs/packages/data-providers/supabase/#select---handling-one-to-many-relationship) and this discord thread (https://discord.com/channels/837692625737613362/1126507458458820689).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@369510721135837184> kapa.ai is still learning and improving, please let us know how it did by reacting below