Can Jarchi filter based on currently active view ?

Started by Bain19, November 14, 2019, 04:08:40 AM

Previous topic - Next topic

Bain19

Was reading through the documentation and didnt see this really mentioned.

Can jarchi create a collection of elements based on currently active view ?

I can filter based on $(selection) , but didnt see anything for activeview.

For what its worth, is $(selection) documented in the jarchi API ... I looked but couldnt find anything.

{edit}

thinking something like $("view").this   


Phil Beauvoir

If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

rchevallier

(reopening on the same subject)

Context: My goal is to develop a script for impact analysis. Ideally I'd like to select 1 element in a view, and then the script will add the elements in the same view according to the model defined (relation & co) down to a level depth.

Testing with $(selection):

* if I select the current view tab and nothing else inside: the selection contains only the archimate-diagram-model as expected
* if I select one element in the model tree: the selection contains only the selected element as expected
* if I select one element inside the current view: the selection contains only the selected element. selection.first() returns this element

How do get a reference to the current view containing it? My understanding would be to use
selection.parents.filter("archimate-diagram-model"), and if it is not empty, it will be the current view.
using .parents() and not .parent() to go thru any container in the graph in case of the element being incorporated visually (eg: Grouping)

Is that right? Any caveat? Other (simpler) way to do it ? Thanks in advance

Phil Beauvoir

If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

rchevallier