How to display automatically properties from an ItemType in a Form from another ItemType, thanks to an ID

Hello,

I'm searching for a solution capable of displaying automatically properties from an ItemType in a Form from another ItemType, with an ID that creates a link between them.

I have an item linked to a form and I have a second item with some properties. I want to populate one field of the first form with the data of the second item. This field corresponds to a certain property of the first item.

To highlight my problem there is an example.

The first Item is called “student_info”. . The other properties don't matter for my problem.

  1. ItemType, Name = “student_info”

1) "student_name", DataType = "Text",

2) "student_class", DataType = "String",

3) "exam_1", DataType = "String"

4) "exam_2", DataType = "String"

5) “id”, DataType = "Item", Data Source = "student_info".

In my form “student_info”, I have a field where I want to display all the exams that a student has passed.



All the exams infos come from the second item. This ItemType is called "exam". It has 5 importants  properties :

  1. ItemType, Name = “exam”

1) "exam_name", DataType = "String",

2) "exam_descrption", DataType = "String",

3) "exam_discipline", DataType = "List", Data Source = "Discipline",

4) "exam_monitor", DataType = "List", Data Source = "Monitor",

5) “id”, DataType = "Item", Data Source = "exams".

I succeeded in changing the “id” with the “exam_name” thanks to another question on this forum !



Each student has passed a different exam. And each exam can be passed by a different student.

So, in my “student_info” form, I have created a HTML Field with an id included in a div. The id is linked to a method called “load_exam” that displays all the exams the student has passed.

BUT for the moment, I need to add manually via a Relationship that I create between the ItemType “student_info” and the ItemType “exam”. To add the exam I need to go in the edit view of the ItemType “student_info” and in the tab called “Add Exam”. And after in a dialog box I choose the right exam.

Now I want to find a solution that automatically displays the list of exams for each student. In fact if I fill the properties “exam_1” and “exam_2” with the exam name, that corresponds exactly to the “exam_name” property. I want to have the list of exams in the HTML Field of the “student_info” Form.

Thanks for reading, I hope you can understand my problem and help me to solve it !

P.S. : I can show my JavaScript code for the method “load_exam”, if you want.