I can clarify the problem with some evidence. To recap, if a report has IsFiltered=true, then while processing reports, instead of the entire report containing all selected groups, it should contain only 1 group.
So I read a report record, then if it is NOT filtered, I generate a report on the server containing all selected groups.
If the report is filtered, I iterate the selected groups and generate a report on the server for that group only. This is accomplished by temporarily setting only that group as IsSelected=true in the SelectedGroups table. when the report is done, it should only include the one group. rinse and repeat for the other selected groups. finally, restore the original SelectedGroups state before moving on to the next report.
I ran this with several log statements to demonstrate the actual issue. This report IS filtered. Two groups, Acting Out and Advances in Science, were selected. Here are some log lines:
Selected groups: [
{"StudyGroupKey":"63955759-3104-4baa-8fc3-f7d792d52351","StudyGroupName":"Acting Out"},
{"StudyGroupKey":"b6fe9ea5-c2ec-47d7-85c5-35c1befcd4f9","StudyGroupName":"Advances in Science"}
]
This was captured at the very beginning of the process.
Here is where the iterating of groups starts.
In each iteration, I log the condition of SelectedGroups , then filter it for the group, then log it again. I then log the first 2 lines of the report query itself.
currentSelectedGroups: [
{"StudyGroupKey":"63955759-3104-4baa-8fc3-f7d792d52351","StudyGroupName":"Acting Out"},
{"StudyGroupKey":"b6fe9ea5-c2ec-47d7-85c5-35c1befcd4f9","StudyGroupName":"Advances in Science"}
]
newSelectedGroups: [
{"StudyGroupKey":"63955759-3104-4baa-8fc3-f7d792d52351","StudyGroupName":"Acting Out"}
]
First 2 lines of report query results:
rqStudyGroupRoster rows=[
{"Category":"Movie Groups","CkNo":"2421","DayOfWeek":"Sunday","FromSFV":"0","GroupName":"Acting Out","Grouptype":"c","MaxMembers":"12","MemberAddress":"491 Twin Oaks Court, Thousand Oaks, CA 91362","MemberCount":"13","MemberEmail":"frank.bonoff@gmail.com","MemberName":"Frank Bonoff","MemberSeq":"1","Paid":"2024-06-01T00:00:00Z","Portfolio":"C","Position":"","PrimaryPhone":"(818) 522-3356","PrimaryPhoneType":"c","PriorGroup":"Acting Out","Registrar":"Judith Stalk","RegistrarAddress":"38 Marimar St, Thousand Oaks, CA 91360","RegistrarEmail":"jstalk@icloud.com","RegistrarPhone":"(310) 350-8400","SecondaryPhone":"","SecondaryPhoneType":"","SortName":"Bonoff, Frank","ValidTo":"2025-06-30T00:00:00Z","Vp":"Frona DeCovnick","VpAddress":"5544 Ranthom Ave., Woodland Hills, CA 91367","VpEmail":"kidzathart@aol.com","VpPhone":"(818) 883-1247","Weeks":"2, 4"},
{"Category":"Movie Groups","CkNo":"6406","DayOfWeek":"Sunday","FromSFV":"0","GroupName":"Acting Out","Grouptype":"c","MaxMembers":"12","MemberAddress":"5544 Ranthom Ave., Woodland Hills, CA 91367","MemberCount":"13","MemberEmail":"kidzathart@aol.com","MemberName":"Frona DeCovnick","MemberSeq":"2","Paid":"2024-06-09T00:00:00Z","Portfolio":"C","Position":"","PrimaryPhone":"(818) 883-1247","PrimaryPhoneType":"h","PriorGroup":"Acting Out","Registrar":"Judith Stalk","RegistrarAddress":"38 Marimar St, Thousand Oaks, CA 91360","RegistrarEmail":"jstalk@icloud.com","RegistrarPhone":"(310) 350-8400","SecondaryPhone":"(818) 621-0129","SecondaryPhoneType":"c","SortName":"DeCovnick, Frona","ValidTo":"2025-06-30T00:00:00Z","Vp":"Frona DeCovnick","VpAddress":"5544 Ranthom Ave., Woodland Hills, CA 91367","VpEmail":"kidzathart@aol.com","VpPhone":"(818) 883-1247","Weeks":"2, 4"},
Here is the next group in the iteration:
currentSelectedGroups: [
{"StudyGroupKey":"63955759-3104-4baa-8fc3-f7d792d52351","StudyGroupName":"Acting Out"}]
newSelectedGroups: [
{"StudyGroupKey":"b6fe9ea5-c2ec-47d7-85c5-35c1befcd4f9","StudyGroupName":"Advances in Science"}
]
And the first 2 lines of report query:
{"Category":"Miscellaneous","CkNo":"4842","DayOfWeek":"Wednesday","FromSFV":"0","GroupName":"Advances in Science","Grouptype":"w","MaxMembers":"15","MemberAddress":"30810 Marseille Way, Westlake Village, CA 91362","MemberCount":"12","MemberEmail":"cohan.steven@gmail.com","MemberName":"Steven Cohan","MemberSeq":"1","Paid":"2024-06-24T00:00:00Z","Portfolio":"A","Position":"","PrimaryPhone":"(301) 503-1672","PrimaryPhoneType":"c","PriorGroup":"Advances in Science","Registrar":"Diane Cohan","RegistrarAddress":"30810 Marseille Way, Westlake Village, CA 91362","RegistrarEmail":"cohan.diane@gmail.com","RegistrarPhone":"(301) 385-9102","SecondaryPhone":"","SecondaryPhoneType":"","SortName":"Cohan, Steven","ValidTo":"2025-06-30T00:00:00Z","Vp":"Alvira Klain","VpAddress":"6619 Daryn Dr., West Hills, CA 91307","VpEmail":"etty10@hotmail.com","VpPhone":"(818) 399-4960","Weeks":"2"},
{"Category":"Miscellaneous","CkNo":"7029","DayOfWeek":"Wednesday","FromSFV":"0","GroupName":"Advances in Science","Grouptype":"w","MaxMembers":"15","MemberAddress":"17455 Flanders St., Granada Hills, CA 91344","MemberCount":"12","MemberEmail":"raven0457@aol.com","MemberName":"Jerry Davidson","MemberSeq":"2","Paid":"2024-06-20T00:00:00Z","Portfolio":"A","Position":"","PrimaryPhone":"(818) 363-9777","PrimaryPhoneType":"c","PriorGroup":"Advances in Science","Registrar":"Diane Cohan","RegistrarAddress":"30810 Marseille Way, Westlake Village, CA 91362","RegistrarEmail":"cohan.diane@gmail.com","RegistrarPhone":"(301) 385-9102","SecondaryPhone":"(818) 384-1432","SecondaryPhoneType":"h","SortName":"Davidson, Jerry","ValidTo":"2025-06-30T00:00:00Z","Vp":"Alvira Klain","VpAddress":"6619 Daryn Dr., West Hills, CA 91307","VpEmail":"etty10@hotmail.com","VpPhone":"(818) 399-4960","Weeks":"2"},
So I believe this proves that the filtering of SelectedGroups to only show the current group selected is working. The report query only includes rows for the group currently being iterated, even though originally 2 groups were selected.
So I think the problem is somewhere in the report generating phase. For some reason, both groups are showing in the report attachment itself.
This logic should totally work, and in fact this is exactly how I’m doing this process in my Access application, which provides the proper output for each group.
I am exporting the latest FDF and it is on the OneDrive folder.
If you want to test this yourselves, please follow these steps:
- Go into Setup>Members and Groups>Members and load Mittelman, Ron record. Change the email address to your preferred test email.
- Go into Processing>Generate Emails>Study Group Leaders
- Go to Attach Reports page, and select Study Group Roster by clicking on it
- Go to Include Study Groups page, and select first 2 groups
- Go to General page and click Generate Emails action button
Within a minute or 2, you’ll get a message that the emails were sent.
What you should get is 2 emails, one for each group, with a single study group roster attached. What you will get is both study groups on both attachments.
Is this enough information to help you solve the issue? Thanks…