July 27, 20178 yr Hi, I have a bit of a dilemma that I've tried a number of solutions to sort out, to no avail. I have a portal that lists the participants in a class. In each row is a checkbox that can be used to indicate whether that participant has withdrawn from the class. I've used a summary field to count the number of checked boxes and have a field that subtracts that number from the total of records in the portal - easy peasy. Where it gets tricky is that, one of the fields relates to the number of children associated with a participant (a mum may have 3 kids in the class if it's one of the playgroups). Now I need to know how many kiddies there are in the class. I have a field that totals the number of children in total and that works fine, but... ... and here's my problem - where a parent has withdrawn (and the box is checked), I need to subtract the number of children associated with that parent from the total number of children). The checkbox is a value list with a single value, 1. All the solutions I've tried so far are fine unless it pertains to portal rows - and I can't figure it out for the life of me. Can anyone help me out?
July 27, 20178 yr A sample file would be helpful, but if I understand you, I think checkboxes are not the way to go. I think for each row you should have a field for participant count. So a portal row with a parent would have that field as 1. A portal row with a parent and 2 kids would have 3. Counting those would be easy with Execute SQL or a standard sub summary report Edited July 27, 20178 yr by Steve Martino
July 27, 20178 yr Author Thanks Steve, classes aren't confined to childcare only, most of them are single person participants, and that count is easy to ascertain correctly. Childcare however, is just the number of children. The parents aren't there. I already have a field that is a calculation that counts the total listed children associated with a parent (in the parent's contact details elsewhere). We have to keep track of whether the participant is active or inactive because they may not come to all the sessions. If they stop coming, they're marked as Inactive (the checkbox), and the class number reflects only active numbers. The inactive box is also linked to their enrolment history, so we can see what people have enrolled in in the past. Once a class is completed, all participants are marked as inactive as that activity has ended. All I need to do is get a total of the number of children there are where the parent has been marked as inactive in that class. Once I get that, it's a simple matter of subtracting it from the total number of children (which I've already got the calculation for).
July 27, 20178 yr There are several ways this could be accomplished. A simple one would be to add a calculation field to the Participants table, along the lines of = If ( not Inactive ; NumberOfChildren ) then change your existing calculation to sum this field instead of the NumberOfChildren field. 4 hours ago, DreadDamsel said: I've used a summary field to count the number of checked boxes and have a field that subtracts that number from the total of records in the portal - easy peasy. I don't see why you need the summary field; you could do simply: Count ( Participants::ClassID ) - Count ( Participants::Inactive )
July 27, 20178 yr 7 minutes ago, comment said: I don't see why you need the summary field; you could do simply: Count ( Participants::ClassID ) - Count ( Participants::Inactive ) I agree, of course, but make sure that the Participants::Inactive field does not contain zeros because they would be counted. Using Sum() might be better for that field as: Count ( Participants::ClassID ) - Sum ( Participants::Inactive ) I am also basing my post on Inactive being a boolean number containing 1. If it is text then Comment's response is best. :-) Edited July 27, 20178 yr by LaRetta
July 27, 20178 yr I assumed the Inactive field is a Number field which can either be empty or contain 1. Otherwise OP's summary field would not work as described. BTW, it could also be a Date field - and IMHO that would be better practice. Edited July 27, 20178 yr by comment
July 28, 20178 yr Author Still can't get it to work. Number_of_children - number, Lookup (source is a calculation which counts the number of entries in a list field) Inactive_Activity - a number, set as Boolean configured so that non-zeros=1 and zeros=0 (source a value list with 1 as the only entry) I need a calculation to go on a field named total_children_inactive_in_class such as (but I can't get to work): if(Inactive_Activity=1 ; sum(Number_of_children) ) Once I have this number, subtracting it from the total of children (which I have) is a simple matter. I need for the admin staff to be able to see both a number of active and inactive children, as if they all turn up at once we exceed our legal limit.
July 28, 20178 yr Does the attached work for you? Note that it's not necessary to sum the inactive children and subtract them from the total. Just sum the active children. -- P.S. Please update your profile to reflect your version and OS. ActiveChildren.fmp12
July 30, 20178 yr Author Comment - Brilliant - was the solution completely. Works like a charm. This has been the last component to getting the project complete and our Community Centre now has a fully-functioning Contacts and Booking Management system. Everyone's help is absolutely fantastic on this forum and has gone a long way to helping me complete this project which I undertook on a voluntary basis for the organisation. Thank you Lesley Wheeler Chair Karingal Neighbourhood House In. Frankston, Vic, Australia
Create an account or sign in to comment