brueegg - Tuesday, August 24, 2010 8:02 AM:
I try to create automatically a Part if a CAD_Document is getting created. This Part should have the same number etc. My problem is the relationship. If I connect the CAD_Document with the Part it works. But if I connect the vice versa relationship Part to CAD_Document I get the Error "CAD_Document already exists". What am I doing wrong? Item relCADPartItem = this.createRelationship("CAD_Document Part","add"); PartItem.lockItem(); Thanks for any advice.
relCADPartItem.setRelatedItem(PartItem);
Item relPartCADItem = PartItem.createRelationship("Part CAD_Document","add");
//Next the Error: "CAD_Document already exists" appears
relPartCADItem.setRelatedItem(this);
brueegg - Wednesday, August 25, 2010 12:56 AM:
I found the error but I don't know what my mistake was!
Item relPartCADItem = PartItem.createRelationship("Part CAD_Document","add");
relPartCADItem.setProperty("related_id", this.getID());
Why do I have to set the related_id? What is the difference between setRelatedItem and setProperty("related_id"...)?
can anyone explain me this please?
Thanks