Author Topic: 'Expire' Assets via jArchi  (Read 267 times)

Alberto

  • Active Member
  • ***
  • Posts: 64
  • Twitter: @albertodmendoza
'Expire' Assets via jArchi
« on: June 20, 2019, 20:10:23 PM »
Hi folks, I need some jArchi help.

How can I run a script through a set of views that have a particular property? And is it possible to trigger this script (and finish) from the command line before generating an HTML report?

Setting:  I have a GIT model which gets published to HTML on a regular basis via CLI.  There are elements that have a 'last updated' date.  I want to modify these elements in Views that have been 'finalized and published' to change their appearance to a yellow/red outline if they are old (90 days) or too old (180 days) since 'last updated'.  I have the script to change the visual appearance (basically a modification of heat map script) but I don't know how to have it run on all views that have the 'finalized and published' property, and that the script runs (and finishes) before it gets exported into the HTML report.


Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1619
  • Code Punk
    • Archi
Re: 'Expire' Assets via jArchi
« Reply #1 on: June 22, 2019, 14:53:04 PM »
Are you able to query the properties in a View to find the property and its value?

Something like:

$("view").each(function(v) {
    var val = v.prop("yourKey");
    if(val == "some value") {
        // Do something
    }
});
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Jean-Baptiste Sarrodie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 716
  • Archi Evangelist and Contributor. Visionary.
    • About me...
Re: 'Expire' Assets via jArchi
« Reply #2 on: June 22, 2019, 19:15:34 PM »
Hi,

There is another option: you can filter using a function:

$("view").filter(function(v) {
    return  v.prop("yourKey") == "some value"
}).each(function(v) {
    // Do something
});
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate