jArchi: getting relationships

Started by Hervé, December 03, 2018, 16:50:21 PM

Previous topic - Next topic



I'm currently playing around with jArchi, which is really a very powerful tool.

Unfortunately, I fail creating my first script  :-[

if ( model == null || model.id == null ) {
   console.log("Please select a model.");
} else {
   var all_app = $("application-component");

   all_app.each(function(app) {
      var relationships = app.rels();

I'm having an error message
   Script Error at: javax.script.ScriptException, javax.script.ScriptException: TypeError: app.rels is not a function in file:/D:/---%20archi/test.ajs at line number 8

What I'd like to achieve is to loop on all the relationships (and also all the concepts at the end of those relationships).

What did I do wrong ?

Thanks in advance

Phil Beauvoir

Hi Hervé,

.rels() works on a collection of objects. So you if you are working with a single object, have to make a collection of one item by using $():

var relationships = $(app).rels();

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


Hi Phil,

Thank you very much ... It is effectively noted in the wiki that it works on collections, but as I've nover done Javascript, I did not notice that my variable was not a collection.

Best regards