johnstephens Posted May 11, 2017 Share Posted May 11, 2017 Hey, Intelligentsia! I have an unusual data modeling need, and I'm not sure how to approach it. I'm creating a ProcessWire template to track Events (after the fact). When creating an event, the user will be able to select a category (Page reference field), start and end times (datepickers), etc. One datum we need to track is the number of participants. - Some participants may have been enrolled previously, so I could have a multi-select page reference field linking to the individual participants. - But some of the participants will not be enrolled, so I'm thinking I need a numeric entry for those who are not enrolled. When I report on participant counts for each event, it would be fine to add the number of registered participants to the numeric entry of unregistered participants to form a total. But when I report on participant counts for a series of events, that won't work. Suppose Event 1 has 25 participants, and event 2 has 26 participants (one participant is new, and the other 25 attended the first event). I create a report that counts participants for both events. I want the report to show 26 participants total—not 51. I'm not sure how to model this. If *every* participant was registered in some way, we could just log unique persons via a mult-select page reference field. But creating a unique identifier for every participant—especially for participants who attend only one event—would be an overwhelming burden for the client. On the other hand, plain numeric entries seem wholly inadequate. I'm not sure how to normalize or finesse the data model to get the information I need without creating an unmanageable data entry chore. Any ideas? Link to comment Share on other sites More sharing options...
ottogal Posted May 11, 2017 Share Posted May 11, 2017 When there is the need to check a new participant if he matches one of the ones enrolled previously, I think you can't avoid having an identifier for every participant. Edit: Assuming every participant is a page (the PW way ), the page's ID would be the natural unique identifer for your purpose. 1 Link to comment Share on other sites More sharing options...
Zeka Posted May 11, 2017 Share Posted May 11, 2017 Maybe you can create separate template for participants, wich will contain all needed field for it. In your event template add page field (Autocomplete or InputfieldChosenSelect) and allow a creation of new pages through this field. So, if your participant is registered you would select it, but if not, you can just enter a name of this participant and add it to the list, but for the next event it will be already in the list of your participants ( will contain only name ). In that way, all of the partisipant will have some unique identifier and it will be quite easy to count them https://processwire.com/api/ref/wire-array/unique/ 1 Link to comment Share on other sites More sharing options...
johnstephens Posted May 14, 2017 Author Share Posted May 14, 2017 Thank you, ottogal and Zeka! The Autocomplete field + allowing page creation is exactly what I needed. Perfect! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now