Remi - Friday, August 7, 2009 8:19 AM:
Hi,
From a manufacturer Part, I have a relationship named SupplierRelation which contain the cost functions of the supplier. I have in in this relationShip a List which indicate if the status of the Supplier if he is Preferered or not.
And I want to get the cost of the Supplier which is check with the status Preferred to put it in field cost in the Manufacturer Part :
So to speak, I want to get a value from a relationship with a certain value at a certain property.
I think it is something like with a condition for the select to choose the Preferred line in the Tab :
var q = parent.thisItem.newItem("SupplierRelation","get");
q.setAttribute("select","cost");
var r = q.apply(); //now r contains required data
it is like in this post www.aras.comhttp:/.../637.aspx but I can't manage to adapt it.
Thanks a lot,
Regards,
Remi
Remi - Tuesday, August 11, 2009 6:01 AM:
So I think I make some progress but It still don't work. I modified my code :
var innovator = new Innnovator();
var itemD = this.newItem("SupplierRelation","get");
itemD.setAttribute("related_id","2FADEA3167224FA9959FED81032B7932");
DocNames.setAttribute("where","id='1486FBB431BB4214ACADA75E8BA11EA8'");
var ItemD = ItemD.apply();
if (ItemD.isError)
{ alert("error");
}
alert("ok");
var count = ItemD.getItemCount();
for ( var i = 0;i < count ; ++i)
{
var itemE = ItemD.getItemByIndex(i);
alert(itemE.getPropery("cost"));
}
I think this is a right way regarding of the forum and the documenation. This method is attached to the form part with an event OnLoad.
But apparently I can't create an Innovator object.
I have tried : var innovator = new Innnovator(); and var innovator = this.newInnnovator();
But I have an error at the execution, is this is related to the Onload event ?
Thanks