This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Copy value to the relationship

Yelena - Thursday, May 21, 2009 12:29 PM:

I am trying to copy value of the property (rfq_number) from the parent item to relationship. On the parent item it is a ‘string’ and on relationship it is an ‘item’. Another property that I am copying (product_type) is a “list” on both “parent” item and “cild”
So here is a method that is executed on relationship “OnInsertRow”
 
var thisItem = parent.thisItem;
var rfq_number = parent.thisItem.getProperty("rfq_number");
var product_type = parent.thisItem.getProperty("product_type");
var child = thisItem.getItemsByXPath("//Item[@id='" + relatedID + "']").getItemByIndex(0);
 
child.setProperty("rfq_number",rfq_number);
child.setProperty("product_type",product_type);
 
 
var objwin = top.aras.uiFindWindowEx(thisItem.getID());
if (objwin) {
  objwin.updateRootItem(parent.item)// refresh grid with new entries
}
 
When I insert a new relationship both values are show up, but when I save the "parent" the rfq_number disappears on the "child".
The rfq_number property is a "string" on the parent and an "item" on the child
The product_type property is a "list" on the parent and the child
What do I do wrong?
 
Thanks for your help
Yelena


tstickel - Sunday, May 24, 2009 10:23 AM:

As you stated, rfq_number is an item property on the relationship.  So you must set it to the ID of the parent item, not the rfq_number from the parent item.  If you do this then Innovator will display the keyed_name of the parent item on the relationship grid.  In general, when a property is an Item property and it contains the ID of an item, Innovator will display the keyed_name of the item on Forms and Grids.  I suspect that the keyed_name for the parent item contains the rfq_number.



Yelena - Sunday, May 24, 2009 10:44 AM:

Terry,

Thank you for reply. Could you please help me with the code?

Should It be

var rfq_number = parent.thisItem.getPropertyAttribute("rfq_number","ID");
child.setProperty("rfq_number",rfq_number);


tstickel - Sunday, May 24, 2009 11:09 AM:

var rfq_number = parent.thisItem.getID()

The getID() method will return the id of the item.



Yelena - Sunday, May 24, 2009 11:58 AM:

Terry,

Thanks again for your help. I am a beginner in the Innovator methods development and your help is greatly appreciated