Forum Discussion
Thanks Angelalp for you answer.
But I already thought about nested forms and they don't match what I'm looking for ...
More simply, I want to extract data from one or more Item from an ItemType (in my case, "exam") with the id of the Item I want. Then I want to display it in a HTML table in my "student_info" Form..
The id is integrated in the form of "String" in my Form "student_info" but is not visible. Every "student_info" Forms have different "id" displayed as "String" so I should have as much data from "exam" in my table.
I wish you can understand what I'm looking for.
Thanks
Hi Harvey,
ah okay. I still do not fully understand your use case, but I see that nested forms are not the right solution for you.
As far as I understand, you are already able to display content in your html element. So your onLoad Method basically works? But why do you want to connect with ids?
Do you have a property in your "Exam" ItemType that contains the linked student? You could than make a simple get query with a filter for the student name and render the table in the html with the onLoad method.
var exam = inn.newItem("Exam","get");
exam .setProperty("student_name", "Kojak");
exam .setAttribute("select","exam_name, result");
exam = exam .apply();
for (var i = 0; i < exam .getItemCount(); i++)
{
// build table in html element
}
- harvey_str6 years agoIdeator II
Hi Angela
Thanks to show some interest for my case. And sorry for my late answer.
[quote userid="4412" url="~/f/development/9071/how-to-display-automatically-properties-from-an-itemtype-in-a-form-from-another-itemtype-thanks-to-an-id/4355"]So your onLoad Method basically works?Yes, the method works fine. But it only works when, on the view form, I go on Tab RelationShip and add the relationship manually. I've create a relationship between "student_info" and "exam" Itemtype. Actually this is the only solution i've found to display the "exam" properties in the "student_info" Form.
[quote userid="4412" url="~/f/development/9071/how-to-display-automatically-properties-from-an-itemtype-in-a-form-from-another-itemtype-thanks-to-an-id/4355"]But why do you want to connect with ids?I want to automate what I explained above.. This is why i want to use id's. In my "student_info" Form, i've Text Field Type. In these Text Field, I have the id of the "exam" ItemType. I don't need to fiil each Text Field because their content come from an imported excel file.
In other words, I'm searching for an automatic way to search through all Items from an ItemType, the Item which has the same id of the content of a Text Field in a Form. Then, when this Item is selected, I want to display it in this same form.
I hope you can understand my needs now.
- cogres6 years agoCreator III
Hi Harvey,
I also have some issues understanding your setup (why do you want to link student_info and exams via a string property? Why not at least use an "Item" property or just use what you are currently using, i.e. explicit relationship; just sounds much cleaner to me to have an explicit link between items in Aras rather than some string), but if I understand you correctly, Angela's second suggestion should still work. Assuming you have an Innovator object called "inn" and a method that gets the Exam-ID-property on student_info:
var examId = getTheStringPropertyThatStoresTheIdOfTheExam();
var examItem = inn.newItem("Exam", "get");
examItem.setID(examId);
examItem = examItem.apply();
Then you have the relevant Exam Item and can fill your HTML-table with the properties of that item.
If you use an "Item"-property on "student_info" that actually links the Item "student_info" to the item "Exam", you can also use foreign properties out-of-the-box, no need to code anything. If you google "Aras Foreign Properties" you will find some (older but at their core still valid) blog posts explaining how they work.Cheers,
C
- harvey_str6 years agoIdeator II
Thanks a lot, your answer about foreign properties gave me an idea.
So now, I'm able to display the data I want in an HTML table in my "student_info" form.
But the purpose is to automate this process, To achieve this, I need to find a method to do a "copy-paste" the value from a text field to an item field. Whose are in the same form. I attach a picture to illustrate my point. In my text field, I have a string, which correspond to the ID of the item. I see that you can write ID in it when the item is lock. and it's a link towards the related item when it's unlocked.
Can you rovide me some advices to write the good method to do this ?
I hope your can understand my need.
Thanks