Creating a Project List
This Data Set script creates a list of all available projects in Stages and returns the Project ID and the full path of the project.
saveColumn(pkit.getRootProject()); getChilds(pkit.getRootProject()); function getChilds(project){ var myprojects = project.getEntities("hierarchy::hierarchic@LOCAL,targetrole=children"); for (var i=0;i<myprojects.length;i++){ saveColumn(myprojects[i]); getChilds(myprojects[i]); } } function projectparent(project) { var myprojects = project.getEntities("hierarchy::hierarchic@LOCAL,targetrole=parent"); var Path = new Array(); if (myprojects.length == 0) { Path.unshift(project.getProperty("Name")); return Path; } var Name = myprojects[0].getProperty("Name"); Path.unshift(project.getProperty("Name")); while (!Name.match(/INDEX/)) { Path.unshift(Name); project = myprojects[0]; myprojects = project.getEntities("hierarchy::hierarchic@LOCAL,targetrole=parent"); if (myprojects.length ==0) break; Name = myprojects[0].getProperty("Name"); } return Path; } function saveColumn(project){ var metamodell = project.getEntities("containsProcess@SYSTEM"); if (metamodell.length> 0 ) { dataset.setColumnValue("project_id", metamodell[0].getProperty("ProjectId")); dataset.setColumnValue("full_name", projectparent(project).join("|")); dataset.storeResultRow(); } }