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 - "Where Used" API ?

JensRollenmueller - Friday, October 29, 2010 1:57 AM:

Hello,

I'm trying to create a user method "Replace Where Used" which is replacing my selected Item in all Item Types where it is used !

Unfortuneately I found no API Item.whereUsed, which is returning me a list of Items where the current Item is used.

I think i can do I it by my own by a method:

1) Browse the data model and get the source Items of my Item Type in the Item => Item Relations
2) Perform selects in all these ItemTypes with my current Item.getID()
3) Put this List into a Item Element

Any other Ideas?

Regards, Jens



PeterSchroer - Friday, October 29, 2010 8:10 AM:

You design approach sounds OK.    This is the same as I have done in other projects.       If you download the "CMII Affected Items Wizard" from the CommunityProjects,   you will see some sample code for Where-Used.     NOTE:  for the CMII Wizard,  some of the work of walking up the structures is done with a stored SQL procedure.    When you are working with very large structures,  it is more efficient to move the crawling of data + relationships into the database.    The multi-level BOM community project also uses a Stored procedure (in this case to walk down very large product structures).