Compare Nodes within a Java-Script

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2013 09:57 AM
I have a script that starts after a file with a specific aspect has been deleted. A function of this script is searching in the folder of the file for other files with the same aspect. Is there no other file it sets an aspect to the folder.
Is there a way to compare two nodes? In the following script I also get an unequal for nodes that are the same (the deleted node).
The only solution that works in the moment is to count the files that have the same aspect as the deleted file. If it is 1, there is no other file.
Is there a way to compare two nodes? In the following script I also get an unequal for nodes that are the same (the deleted node).
function checkSpaceForAspect(node, asp, aspToSet){ i = 0; var nodeSpace = node.parent; for each (n in nodeSpace.children) { if(n.hasAspect(asp)) { if(node.nodeRef!= n.nodeRef) { return; } } } //No Aspect found addAspToParent(node, aspToSet, "0"); return;}
The only solution that works in the moment is to count the files that have the same aspect as the deleted file. If it is 1, there is no other file.
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2013 05:02 AM
Hello,
I see nothing wrong with that script.
How do you check wether the comparison fails or not? Only by checking that the aspect has been applied to the parent?
If so I'd suggest you to try to debug your script step by step in the javascript debugger.
Regards,
I see nothing wrong with that script.
How do you check wether the comparison fails or not? Only by checking that the aspect has been applied to the parent?
If so I'd suggest you to try to debug your script step by step in the javascript debugger.
Regards,
