Script to select all Application Component elements in the current view

Started by viraght, October 15, 2024, 13:30:55 PM

Previous topic - Next topic

viraght

I want to create a script to select all Application Component elements in the current view because as I see there is no such select-by-type in the current view built in function in Archi. Image a try with the following code and realised that it counts the Application Component elements correctly but unfortunately the selection does not changed in the view. This code works on the selected elements in the current view. Any hints to modify the script? Thanks. /*
 * Application Component elemek kiszelektálása a View szelektált elemei között Script
 */
 
// Az aktuálisan kiválasztott elemek között keresünk Application Component típusúakat
var applicationComponents = [];

// Szűrés Application Component típusú elemekre
selection.filter("application-component").each(function(e) {
    applicationComponents.push(e);
});

// Ellenőrizzük, hogy találtunk-e Application Component elemeket
if (applicationComponents.length === 0) {
    console.log("Nincsenek Application Component elemek a kiválasztásban.");
} else {
    // Az aktuális kiválasztás törlése, ha találtunk elemeket
    selection.clear();

    // Egyenként hozzáadjuk az Application Component elemeket a kiválasztáshoz
    applicationComponents.forEach(function(component) {
        selection.add(component);
    });

    console.log(applicationComponents.length + " Application Component elem kiválasztva.");
}


Phil Beauvoir

Hi, selection of objects in views is not supported in jArchi.

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