Hi Expert,
When I add components in BOM tab of a part, I need to check 'State' of each components added using Grid Events in RelationshipType of a Part.
Event is 'OnInsertRow'.
When I click '+' button and pick a component, javascript needs to capture the value of 'State' (e.g: Preliminary, Released).
But, a user can click '+' button one time, and select multiple components.
In this case, how to capture each one of them (I mean 'state' of each component)?
I used the codes below:
var thisRel = tmpThisItem.getItemsByXPath("//Item[@id='" + relationshipID + "']").getItemByIndex(0);
var stringthisRel = "" + thisRel;
if ( stringthisRel.includes("Preliminary") ) {
.....
}
But, it seems to fail to get state value from each line of selected components.
Instead, "stringthisRel.includes("Preliminary") " search all lines added.
Would you help how to solve this issue?
Thank you.
Hello,
Could you please include which version of Aras Innovator you are using? I ran a quick test in 11.0 SP12, and found that the onInsertRow event was called individually for each relationship even if I added multiple Parts at once.
Additionally, you can more directly check for the state of the related part by using the sample below.
var relatedNd = parent.thisItem.node.selectSingleNode("//Item[@id='" + relatedID + "']");
var relatedState = aras.getItemProperty(relatedNd, "state");
if (relatedState == "Preliminary") {
// Run additional logic here
}
Chris
Christopher Gillis
Aras Labs Software Engineer