Copy value to the relationship

rated by 0 users
This post has 4 Replies | 0 Followers

Top 50 Contributor
Posts 36
Points 425
Yelena Posted: Thu, 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

Yelena
Top 25 Contributor
Posts 86
Points 1,295
tstickel replied on Sun, 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.

Terry Stickel, PDM Consultant

TStickel Consulting

Sanibel, Florida

  • | Post Points: 20
Top 50 Contributor
Posts 36
Points 425
Yelena replied on Sun, 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);

Yelena
  • | Post Points: 20
Top 25 Contributor
Posts 86
Points 1,295
tstickel replied on Sun, May 24 2009 11:09 AM

var rfq_number = parent.thisItem.getID()

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

Terry Stickel, PDM Consultant

TStickel Consulting

Sanibel, Florida

  • | Post Points: 20
Top 50 Contributor
Posts 36
Points 425
Yelena replied on Sun, 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

Yelena
  • | Post Points: 5
Page 1 of 1 (5 items) | RSS