Table Aggregrate Component Question
How would I generally write the TableAggregrate component for this? I am very confused and I can't seem to understand or figure it out. My goal is to count number of likes from an input of university id
8 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
If all you need to do is count likes for each university id, i would use the sharded-counter component instead
Can you share the code for what you have so far?
I saw the sharded counter but I didn't see a way to calculate all likes for a particular university id - i didn't see place to mention id anywhere. I have the schema (and other functions not related to what i am trying to do now) and I can share that if you like...
oh nvm i am blind
i found this now

oh i also remembered now why i wanted to use aggregate - i also wanted to find out number of likes over the past week and i saw on the docs page that i could do it with aggregate
Oh yeah then you want aggregate
Have you tried installing and configuring the component? How far did you get
yep installing and configuring is done. I was trying to write the
TableAggregate
now and got confused with the type of parentId
- below is my first attempt
this is probably best suited for my case. can someone teach me how to add bounds to this query? for eg: how do i get total likes from a university from the past 7 days?
does this look good?Looks good to me
If you're just using count, you don't need to set sumValue
Otherwise looks like it should work 🙂