one to may or multiple groups

Teide

Member
Hi,
I am creating a database using this plug-in which imho is great.
I like some expert advise hot to create it.
The situation is as follows:
It is for a school where you have parents, each parent might have multiple childs and each child might assist to multiple activities.

I would like to know which is the best way of doing this? one to many relations or multiple groups in one list?
Thanks a lot for you help.
 
I would create a Parents List and a Pupil List. The Pupil list should have an integer field element called parent_id as well as its own internalid element. Set the Pupil group to be Repeating.

Then go into the Parent List and add a LEFT JOIN from Parent.id to Pupil.parent_id. And add the Pupil group to the Parent Form.

This should create a Repeat Group for Pupil, so the Parent form will now display the parent's details plus repeating rows for as many children they have as pupils.

(I am suggesting you do it this way rather than create a separate Group in Parents called Pupils and then setting the Pupil group to repeat as this allows you to name the table explicitly and you can then use the Pupil list separately.)

Then create a separate Actvities List and use the databasejoin element to link from the Pupil to Actvities using the multi-checkbox option. This allows for a many-to-many relationship between Pupils and Activities.

Hope this helps. Let us know how you get on.

S
 
Hello, Thankyou for your help.
I have created the parents and pupils list and it works fine, the only problem is that if I add a child using the pupils list it disapper when adding his parent afterwards using the parent list. I just remove the option to add using pupils list. Now ready for the second part. Thanks a lot
 
Yes - if you create a pupil first, then you would need to set the parent_id manually to the value of the id field of the parent record.

I am not sure what would happen if you made parent_id a databasejoin element pointing to the parent table - you would then have both a repeat group join and a databasejoin join on the same fields between the two tables. But if it works you could add pupils without a parent (orphaned pupil?), and then when you have created the parent record, you can select the parent for the pupil and make them not orphaned.

S
 
Hi, I will have to go back to fabrik 3.0.8 and joomla 2.5 as not able to print with 3.1. Will let you know how is it going on... Thanks
 
Hi,
After a good time playing with this I have done a left join from parent to pupils and the hide de pupil parent id and remove the option to add from pupils form. That will make that to enter information you can only use the parent form avoiding having orphan kids.... Thanks Now working on the many to many join from pupils to activities...
 
For that create an Activity list and use a databasejoin element in the pupils group toi link it - set to checkbox and multiple.

S
 
I tried this but as every activity needs to have a diferent start and finish date so then can list the pupils that has been in each activity and what days I decided to create a diferent id for each pupil and then do the the as I have done with the parent and pupils list, and a left join. Then will remove the add option from the activities list so all the info need to be entered using the parent form. Hope this works. Thank for you support.
 
Ah - well as you seem to have surmised, you cannot do this as nested repeat groups.

However, I think you can have a Parent List which has Pupil as a repeat group, and a Pupil list which has Activity as a repeat group.

S
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top