Hi Helena:
Massa is showing you wherein the data collection you need to configure the reference that you need to set up to ‘join’ two data collections. Once this is done you obviously need to make sure that you are able to add the reference links in the table to establish the relationships between teams, team members, projects. So it is important that you understand the data models you are using and the relationships each collection has to the others.
As an example you may want to consider three Data collections TeamMember, Team and Project
It sounds like Team and TeamMembers is a ManyToMany relationship:
Team hasMany TeamMembers
TeamMember hasMany Teams
So you would add a reference field in Team that allows for multiple TeamMember references
and you would add a reference in TeamMember for multiple Team references
It sounds like Team and Project could be a ManyToOne relationship?
Project belongsTo Team
Team hasMany Projects
So you would add a reference field in Project that can contain only one Team
and you would add a reference field in Team that can contain multiple Projects.
Then you would use dataset filters connecting the relevant tables to get the results you are looking for.
Now - in your original question you mentioned that you have a text list of team members in the project. The TeamMember collection I mention above would potentially replace this text field.
You could still do something similar with this text field, but you may find it a lot of code.
You would need to extract each member from the list using a string split function to create an array of team members . With this array you could populate a repeater with a button or text element that is clickable and named using the team member name.
When the repeater button is clicked you would then need to find each project that contains the button element name in the project team member list of other projects. You can use the same string split method and then search the resulting array or you can use the string includes function to see if the team member’s name is present. This will help you build an array of matching projects for the Team Member.
WARNING: The reason why using a data collection for TeamMembers is probably more preferable to a text list comma separated is because text can be problematic. If you are letting project managers or team leads enter team member names in free form then you will have to start thinking about the multiple ways names could be entered. For example there may be a team member called Samuel Smith. This name could appear in multiple different ways:
- Samuel Smith
- samuel smith
- Sam Smith
- sam smith
- S Smith
- s smith
- Smith
You may also have name conflicts (there may be two Sam Smiths).
So when you are building the list of projects that Sam Smith is on you will need to make sure you cater for all the variations and duplicates.
The way to prevent this is to have unique records for each team member and use drop down lists to add them to the project or force naming and spelling conventions on the text entry :-).
In addition to Massa’s reference recommendations you might want to check out these articles:
https://support.wix.com/en/wix-code/connecting-data
Hope this helps
Steve