apparent-cyan
apparent-cyan9mo ago

How to join populated row by count

I am using useSimpleList, with the following config: meta: { populate: { jobRole: { fields: '*' } } } I am getting all jobRole related which the main query for each row But instead of that, I need to get the count of jobRoles per each row, instead of the array of elements Is it possible to do that count functionality it with the query in a native way?
2 Replies
kapa.ai
kapa.ai9mo ago
Hi @Facu. 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. The information extracts provided do not contain specific details on how to achieve a count functionality with the useSimpleList hook in refine. However, refine does provide a way to request estimations of the total count by passing the count property in the meta as shown in the useList hook example from the Supabase documentation (https://refine.dev/docs/packages/documentation/data-providers/supabase/#getlist---performance).
useList({
resource: "posts",
meta: {
count: "estimated",
},
});
useList({
resource: "posts",
meta: {
count: "estimated",
},
});
This might not directly apply to your case, but it could give you a hint on how to proceed. For more specific guidance, I recommend checking the refine documentation (https://refine.dev/docs) or seeking help from the community on the refine Discord server (https://discord.com/channels/837692625737613362/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai9mo ago
<@411223164698492929> kapa.ai is still learning and improving, please let us know how it did by reacting below