Skip to main content
Solved

Summarizing values from one table in another

  • July 16, 2020
  • 3 replies
  • 28 views

Forum|alt.badge.img

I have a users table which has a user_id and points field. I have a points_events table which logs each time a user_id receive points for an action

I need the points field in the users table to sum the total points associated with that user_id from the records in the points_events table.

How can I do this? I need it to be as automatic as possible. Thanks for any help you can offer!

Best answer by Kamille_Parks11

If you’re referring to adding records via the API, I think Link Records fields take an array of record IDs. So this is possible, you’ll just need to do some extra work finding the record id for matching user_id values in the users table.

3 replies

Kamille_Parks11
Forum|alt.badge.img+27

Assuming your user_id field in the points_events table is a Link to Another Record type field, your points in your users table could be a Rollup field with a SUM(values) aggregation.


Forum|alt.badge.img
  • Author
  • New Participant
  • 1 reply
  • July 16, 2020

Assuming your user_id field in the points_events table is a Link to Another Record type field, your points in your users table could be a Rollup field with a SUM(values) aggregation.


Thanks so much for your response! This makes intuitive sense to me, but will I be able to POST records to points_events that automatically link to user_id in the users table?


Kamille_Parks11
Forum|alt.badge.img+27
  • Brainy
  • 2679 replies
  • Answer
  • July 16, 2020

If you’re referring to adding records via the API, I think Link Records fields take an array of record IDs. So this is possible, you’ll just need to do some extra work finding the record id for matching user_id values in the users table.