Author Topic: jArchi folder path?  (Read 98 times)

Alberto

  • Member
  • **
  • Posts: 23
  • Twitter: @albertodmendoza
jArchi folder path?
« on: December 12, 2018, 16:32:10 PM »
How do I retrieve the path of folders and name of a view or element via jArchi?

e.g. "Views\Folder 1\Folder 2\My Archimate View 1"    or "Business\Business Actor"


Phil Beauvoir

  • Archi Master
  • Hero Member
  • *****
  • Posts: 938
    • Archi
Re: jArchi folder path?
« Reply #1 on: December 12, 2018, 17:04:46 PM »
You can use .parents() on a collection. So, for example, if you select one node on the models tree ("selection"):

Code: [Select]

var path = "";

var parents = selection.parents();

for(i = parents.length - 1; i >= 0; i--) {
    path += "\\" + parents[i].name;
}

path += "\\" + selection.first().name;

If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate