Archi Forum

Archi => General Archi Discussion => Topic started by: faruki on July 27, 2020, 12:30:48 PM

Title: Create single table in Archi
Post by: faruki on July 27, 2020, 12:30:48 PM
Hi,

I want to show all the enterprise applications in a single table for audit query. Is it possible to do it in Archi?

Regards,
Title: Re: Create single table in Archi
Post by: Phil Beauvoir on July 27, 2020, 18:30:47 PM
Hi, not really as you can't create tables in Archi. Perhaps you can extract and present the data by some other means.
Title: Re: Create single table in Archi
Post by: Jean-Baptiste Sarrodie on July 27, 2020, 19:45:39 PM
Hi,

You can do it through a jArchi (https://www.archimatetool.com/plugins/#jArchi) script.

You can also run a sql query on the query tab included in the default HTML report: right click on your model, select Preview HTML report, then (when the report appears in Archi) select the Query tab and, at the "alasql>" prompt, enter:
SELECT name FROM Elements WHERE type = 'ApplicationComponent'

You can export the result of any query in CSV by adding an INTO clause:
SELECT name INTO CSV('export.csv') FROM Elements WHERE type = 'ApplicationComponent'

Regards,

JB
Title: Re: Create single table in Archi
Post by: faruki on July 28, 2020, 06:44:01 AM
Thanks for the feedback. I'll try it.
Title: Re: Create single table in Archi
Post by: bigyin on July 29, 2020, 15:48:22 PM
Would be grateful for help with a more complicated use case (lack of my SQL etc ..) to get the CSV

Elements (services) linked to requirements and plateau (current, state, target state) and to Status (Deployed, etc).

is it possible to output a table of all linked to a defined plateau e.g all services, and the requirements that are related with  specific relationship types (e.g. serving, flows to etc)

View is made, trying to get output from view to csv for follow tracing etc by non architects
Title: Re: Create single table in Archi
Post by: projetnumero9 on July 29, 2020, 19:28:00 PM

Without using jArchi, that is a bit tricky, AFAIAC.
What I came up with, as a first step, is:


WITH RelationshipsMatrix AS (SELECT * FROM Relationships),
IdNameMatrix1 AS (SELECT name, id FROM Elements),
IdNameMatrix2 AS (SELECT name, id FROM Elements),
PropertiesSubset1 AS (SELECT * FROM Properties WHERE propkey = "status" and propvalue= "deployed"),
PropertiesSubset2 AS (SELECT * FROM Properties WHERE propkey = "status" and propvalue= "deployed")
SELECT RelationshipsMatrix.type AS RelationType, RelationshipsMatrix.name AS RelationName, IdNameMatrix1.name AS SourceName, PropertiesSubset1.propvalue AS SourceStatus, IdNameMatrix2.name AS TargetName, PropertiesSubset2.propvalue AS TargetStatus
INTO CSV("test.csv",{headers:true})
FROM IdNameMatrix1 INNER JOIN RelationshipsMatrix ON RelationshipsMatrix.sourceid = IdNameMatrix1.id
INNER JOIN IdNameMatrix2 ON RelationshipsMatrix.targetid = IdNameMatrix2.id
INNER JOIN PropertiesSubset1 ON PropertiesSubset1.conceptid = IdNameMatrix1.id
INNER JOIN PropertiesSubset2 ON PropertiesSubset2.conceptid = IdNameMatrix2.id


It outputs in a .CSV file, named test.csv, the following:
- RelationType
- RelationName
- SourceName
- SourceStatus
- TargetName
- TargetStatus
, the WHERE clause being
- source and target concepts have to have a property, named "status", and set to "deployed"

That reports on the whole model.
To report only on a view, tables Views and ViewsContent could be used but I, for the time being, did not find out how to relate "ViewsContent.contentid" with "Elements.id", which would then permit to filter my IdNameMatrix* in my example query with something like:


Select * FROM Elements INNER JOIN ViewsContent on Elements.id = ViewsContent.contentid
INNER JOIN Views ON ViewsContent.viewid = Views.id
WHERE Views.name = "PlateauName"

Title: Re: Create single table in Archi
Post by: AlexL on August 05, 2020, 19:42:51 PM
Actualy it is a big thing to make archi create traceability matrices and other table data representations.

For example if Archi would have a native mechanism to make a table view in model with further export into HTML report - it would be REALY great.