AnsweredAssumed Answered

Update summary table from related tables using scripts

Question asked by barbaragnelson on Feb 17, 2018
Latest reply on Feb 19, 2018 by barbaragnelson

I am building a dashboard with charts and summary metrics and have found it easiest when all of the summary data I need is in one file (thanks to posts in this forum). I have figured out how to update summary monthly totals from the detailed file (Requests) by finding records by month and using Set Field to update using GetSummary from the detailed file.


Now I'm trying to update a different file (Docents) with summaries from the same detailed file (Requests) to perform some calculations and summaries based on totals in the Requests file. I have set up a relationship and have created Summary fields sorted by Requests::Docent. With my monthly totals, I went through specific months in my script because there are only 12 and they are fixed. But I have many more Docents and don't know how to loop through the Docents to update using Set Field to update Summary fields from Requests. This is the beginning of my script but I know I'm missing something because the Docent records are not being updated:


Go to Layout [which has both related files - Requests and Docents, sorted by the break field]

Set Error Capture [On]

Perform Find [Restore]

If [Get (FoundCount) =0]


     Sort Records [Restore; With dialog; Off]         I'm sorting by Requests::Docent

     Set Field [Docent Info::Classes from Requests; Get Summary (Requests::Classes by Docent ; Requests::Docent ) ]

End If


I am not a programmer but have learned a lot about FileMaker from this forum. I appreciate any help you can give me.