Search and display attributes from an associated entity
Hi there, Hope everyone is safe and well. I am on the first steps of learning Mendix and appreciate your advice. I have two Excels: one with details about Teachers another with details about Schools. Each teacher belongs to one school and each school can have multiple teachers. So in the domain, I have Teacher entity pointing to the school entity with * to 1 association. In the teachers' data, I have details about individuals: Names, degree, graduation year, and the name of the school they are teaching in. In the schools' data, I have several columns, but one is about the level of their paper-free courses, so in my Schools entity, I have enumeration as green, orange and red. What I want to do is to add a search bar to the homepage, so we can search for a teacher’s name and get the result about their school’s paper-free level. First steps I have taken are: - Built a list view for teachers, with the search on [Name, SchoolName]. - Then added another data view that listens to the above list view and displays the details for the entity “Teacher” (when we search for their name). - I am trying to find a way to also have a teacher’s school level for paper-free courses (when we search for their name and get the details). Also, in “Edit List View Search” for teachers, I can see almost all the attributes for school (associated), except the enumerations. But I don’t know whether that’s sth I have done wrong or there are other steps I need to take.
Take these two steps:
- remove the SchoolName attribute from the Teacher entity, since it is not an attribute of the teacher but of its associated school.
- in the listening teacher data view add another data view with has as data source: the school over association from the teacher. When Studio asks you if you want the dataview to get autofilled with the school’s attributes, say yes.
And you’re good to go.
Btw. if you combine the two Excels into one, having two tabs, ‘Teacher’ and ‘School’, filled with data, feed the Excel to Studio when creating ‘App from a spreadsheet’, it will allow you to set the association and generate the pages for you.