Forum Discussion

AlexGale's avatar
AlexGale
Qrew Captain
6 years ago

Use API_AddField to add a summary field

Hi, 

I have a table called Categories, where each record is a different category. There are 20 or so Categories. These categories are used as reference fields on a child Projects table. 

I have another table called Opportunities that's a parent of the Projects table. On the Opportunities table I've created a summary field for each Category. The summary fields count the number of Projects for each Category under the Opportunity. 

My problem is that occasionally the category table will be updated, usually by adding a new category record. I don't want to have to constantly monitor this table and remember to add a new summary field to the Opportunities table whenever a category record is added. 

Is there a way to use the API_AddField call to add a summary field to the Opportunities table whenever a Category record is added, which counts the number of Projects where the "Related Category" field is equal to the newly created Category record?

The documentation for API_AddField doesn't specifically mention summary fields so I don't have too much hope here, but I figure its worth asking around.

------------------------------
Thanks,
Alex
------------------------------
  • Hi Alex, you're right that you would not be able to create new summary fields using API_AddRecord. BUT, I'm curious to know how important it is to see these counts of how many projects there are per category, for each category, on a report. If it's helpful instead to click into a single opportunity, and see how many projects there are under each category that way, you can update the embedded report of projects on your opportunities form and use a summary report there.

    If you do need to see a report of many opportunities, with counts of how many projects there are under each category, you would need to use some kind of integration platform or custom script to do the number crunching. Then you could create normal numeric fields using API_AddField, and push the results there. This is the kind of thing I expect you'll be able to accomplish with CloudPipes as well so definitely look out for the early access program starting closer to the end of the year!

    ------------------------------
    Brian Cafferelli
    ------------------------------