Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Hurra

Pages: [1] 2 3 ... 5
1
Hello!

I have defined a custom stereotype which is a generalization of SysML1.4::block and metaclass Class.

I have defined a custom relationship with metaclass Aggregation (I don't see any stereotype on SysML relationships part/shared association).

When I create two of these stereotypes and a connector between them, it works. But I don't get any property/type object as child in the 'whole'.

I've tried to create a generalization on my custom diagram: SysML::Block Definition, but didn't do anything. The SysML diagrams doesn't seem to have a stereotype assigned to them?

How do I change my MDG to create part/properties object when adding a connector like composition/aggregation, like in the SysML MDG?

It was a long time ago since I played around creating an MDG 😇

Thanks!

Note: my stereotype have Instance Behavior Mode: Property

2
Hello!

(using JScript)

I initialize CSV-import:

Code: [Select]
    try
    {
        CSVIImportFile(fileName, firstRowContainsHeadings); // See EAScriptLib.JScript-CSV
    }
    catch (error)
    {
        log(true, "Error importing CSV file. Is the path correct? Is the file open?");
        log(true, "Stopping script...");
        log(true, "====================END====================");
        return;
    }

Then in OnRowImported() I check for my defined columns:
Code: [Select]
function OnRowImported()
{
if (!checkForColumns(columns))
{
log(true, "Column not found, stopping script...");
return;
}
...

where checkForColumns() uses CSVIContainsColumn() from EAScriptLib.JScript-CSV:
Code: [Select]
...
if (CSVIContainsColumn(column) == false)
...

However, CSVIContainsColumn(column) always returns false for the first column.

Example CSV:
Code: [Select]
first;second;
1;2;
a;b;

I define my variable columns as
Code: [Select]
columns = ['first', 'second'];
The function from EAScriptLib.JScript-CSV returns false:
Code: [Select]
CSVIContainsColumn('first') -> false

If I however add a dummy column in the beginning, like:
Code: [Select]
zero;first;second;
;1;2;
;a;b;

then
Code: [Select]
CSVIContainsColumn('first') -> true

Later, after importing and creating elements, I add the GUIDs of said elements back to the CSV.

But I discard the dummy-column, so after import and export the CSV looks like this:
Code: [Select]
first;second;guid;
1;2;guid1;
a;b;guid2;

Then all of a sudden CSVIContainsColumn('first') -> true without the dummy column...

I have no idea what's going on and don't know how to troubleshoot this. Hopefully someone can follow my explanation.

Can it have anything to do with different types of CSV's? In Excel there are options for (at least for me):
  • CSV-UTF-8
  • CSV
  • CSV (Macintosh)
  • CSV (MS-DOS)

Is there a known bug using EAScriptLib.JScript-CSV and specifically CSVIContainsColumn()?

Any help or pointers appreciated! Thanks!

I'm on version 16.0.1604

3
General Board / Remove ctrl+9 hotkey
« on: November 10, 2023, 08:01:31 pm »
Hello!

When I write scripts I press ctrl+alt+9 to make ] on my keyboard layout.

However, EA always opens the 'Discuss & Review' window, with the hotkey ctrl+9.

I've been here:
https://sparxsystems.com/enterprise_architect_user_guide/16.1/the_application_desktop/customizekeyboardshortcuts.html

But I can't find the ctrl+9 hotkey.

The ctrl+9 hotkey is deocumented here:
https://sparxsystems.com/enterprise_architect_user_guide/16.1/the_application_desktop/keyboardshortcuts.html


When I go to:
Start > Appearance > Preferences > Other Options > Keyboard
Element > Discussion

which I think is the hotkey is, it's empty, no assigned hotkey.

I can't for the love of god not find where ctrl+9 is assigned and remove it.

Any help?

Thanks!

4
Hello!

I'm getting a lot of scripts in EA.

How do you version control your scripts?

Do you copy and paste your scripts in an external tool e.g.Visual Studio Code and have that repository version controlled, like git? Or do you have the version control in Sparx EA directly?

Also, can I create 'folders' when right-clicking -> Specialize -> Scripts? That list showing up is getting way to big.

Thank you!

5
Hello!

I use NAFv4 and have modelled Operational Views with the following:

«OperationalPerformer» --- IsCapableToPerform --> «OperationalActivity»

From this I create stakeholder requirements with the following syntax:

The system shall enable «OperationalPerformer» to «OperationalActivity».

I know seems like a waste, but it's a government agency 😇 "it has to be textual requirements"

🤔I just wanted to know if someone have any ideas of how I can keep track of which performers and acitvities which have requirements. My thought is to be able to generate these requirements when there are changes in the Operational Views. E.g. a new performer, or added activities to an existing performer.

💡One idea that pops up is to create a connector (maybe «trace»?) between the requirement to the performer and activity. And before creating a requirement, check if there is a corresponding requirement for the performer and activity in focus. If there is a requirement, just update the requirement text.

❓Any thoughts of how I can implement such a thing, and is the connector approach any good? Is there another way?

Thank you!

6
Hello!

I have a query where I get all requirements in a branch.

Then I left join with another group or requirements and LEFT JOIN based on connector (deriveReqt).

Then I left join again with a group of system element and LEFT JOIN based on connector (satisfy).

So the setup is the following:

Code: [Select]
(system element) -- satisfy --> (system requirement) -- deriveReqt --> (stakeholder requirement)
Initially my output was two columns, one for ID of system requirements, and one for related stakeholder requirements which was grouped so the output would be something like this example:

System requirement ID | derived Stakeholder requirement ID
1 | 3
2 | 5, 8
3 | 6, 11
4 | 1, 7

But when I added a third column with system elements which satisfy the system requirements, the stakeholder column gets duplicated with the number of related system elements, for example:

System requirement ID | derived Stakeholder requirement ID | System element
1 | 3 | SE-1
2 | 5, 8, 5, 8 | SE-1, SE-2
3 | 6, 11 | SE-3
4 | 7, 7, 7 | SE-1, SE-2, SE-3

I can clearly see the connection between duplication of 'derived Stakeholder requirement ID' and the number of related 'System element'.

But I have no idea how I fix that.

The desired output would be:

System requirement ID | derived Stakeholder requirement ID | System element
1 | 3 | SE-1
2 | 5, 8 | SE-1, SE-2
3 | 6, 11 | SE-3
4 | 7 | SE-1, SE-2, SE-3

Full SQL:
Code: [Select]
SELECT SK_TABLE.CLASSGUID, SK_TABLE.CLASSTYPE,
SK_TABLE.SK_ID AS SK_ID,
SK_TABLE.SK_KAPITEL AS SK_KAPITEL,
SK_TABLE.SK_TEXT AS SK_TEXT,
COALESCE(GROUP_CONCAT(IK_TABLE.IK_ID, '; '), '---') AS IK_ID,
COALESCE(GROUP_CONCAT(SE_TABLE.NAME, '; '), '---') AS SE_NAME

FROM
(SELECT SK.ea_guid AS CLASSGUID, SK.Object_Type AS CLASSTYPE, SK.Object_ID AS SK_OID,
SK_ID.Value AS SK_ID, SK_PACKAGE.Name AS SK_KAPITEL, SK_TEXT.Notes AS SK_TEXT
FROM t_object SK
INNER JOIN t_objectproperties SK_ID ON SK_ID.Object_ID = SK.Object_ID AND SK_ID.Property = 'id'
INNER JOIN t_objectproperties SK_TEXT ON SK_TEXT.Object_ID = SK.Object_ID AND SK_TEXT.Property = 'text'
INNER JOIN t_package SK_PACKAGE ON SK_PACKAGE.Package_ID = SK.Package_ID
WHERE SK.Package_ID IN (#Branch='{4FD8BE48-EE95-44ae-ACCB-A7CE7851EB7C}'#)
AND SK.Stereotype = 'Systemkrav')
SK_TABLE

LEFT JOIN
(SELECT IK_ID.Value AS IK_ID, DERIVE.Start_Object_ID AS 'DERIVE_END'
FROM t_object IK
INNER JOIN t_objectproperties IK_ID ON IK_ID.Object_ID = IK.Object_ID AND IK_ID.Property = 'id'
INNER JOIN t_connector DERIVE ON DERIVE.End_Object_ID = IK.Object_ID AND DERIVE.Stereotype = 'deriveReqt'
WHERE IK.Package_ID IN (#Branch='{20273ECC-AB9C-43e3-8E6D-43E7DD60F3AC}'#)
AND IK.Stereotype = 'Intressentkrav')
IK_TABLE ON SK_TABLE.SK_OID = IK_TABLE.DERIVE_END

LEFT JOIN (
SELECT SE.Name AS NAME, SATISFY.End_Object_ID AS SATISFY_END
FROM t_object SE
INNER JOIN t_connector SATISFY ON SATISFY.Start_Object_ID = SE.Object_ID AND SATISFY.Stereotype = 'satisfy'
WHERE SE.Package_ID IN (#Branch='{95E5A654-A217-4122-B011-045E9F7A720D}'#)
AND SE.Stereotype = 'OperationalPerformer')
SE_TABLE ON SE_TABLE.SATISFY_END = SK_TABLE.SK_OID

GROUP BY SK_TABLE.CLASSGUID
ORDER BY LENGTH(SK_TABLE.SK_ID), SK_TABLE.SK_ID

Any pointers of how I would fix that would be appreciated!

When googling I found something using WITH, but IIRC SQL statements in Sparx EA MUST start with SELECT so didn't even bother to try it out.

Cheers!

7
Hello!

I have some scripts I made for Excel export of ModelViews which I use reguarly in an MS Access environment. I 're-created' this script to use on another project, which we at the moment use a local QEAX-file.

When I run the script I get 'Internal Application Error' on the line:

Code: [Select]
function getChildPackages(Package_GUID, packagesArray)
{
var startPackage as EA.Package;
startpackage = Repository.GetPackageByGuid(Package_GUID); // -> this line is referred to in the error message
--- other stuff ---
}

For context, this script replaces the macro #Branch=<GUID># in the ModelViews SQL to a list with all child packages.

I tried to manually enter (hard-code) the relevant Package_GUID in the .GetPackageByGuid() method, but ended up with an infinite loop and out of memory error...

What's going on? I don't even know how to start to troubleshoot and fix this...

Thanks for any input or suggestions!

edit: MS Access environment is v15.2, QEAX is v16

8
Hello!

I have a script to export a ModelView to Excel.

We changed our environment to a new remote desktop (or something idk).

Before the move, the exported texts (notes, requirement-texts, etc), came in one cell in Excel even when the text included line breaks. But now I can't parse the returning XML because of line breaks.

I use, from the Repository class, SQLQuery (string SQL)
Code: [Select]
queryResult = Repository.SQLQuery(query);
where the query is picked up from the ViewProperties memo on the ModelView.

The error occurs when I try to parse the XML with the built in function:
Code: [Select]
var DOMDoc = XMLParseXML(queryResult);
because of line breaks in queryResult.

Code: [Select]
EAScriptLib.JScript-XML error: Expected token '&&' found 'NAME'.

//Row/Krav-k-->&<--#228;lla, Line:182


Referring me to:
Quote from: JScript-XML
Code: [Select]
182: var nodeList = xmlDOM.documentElement.selectNodes( nodePath );

As I said, I didn't have this problem before.

Can I somehow clean the queryResult before parsing? I know in Excel line break is CHAR(10).

Or should I just remove all the line breaks in all the texts and have to live with it?

Someone out there with a similar issue?

Thank you for your time!

9
Hello!

I have a SQL search based on OBJECT_ID which returns
Code: [Select]
SELECT e.ea_guid AS CLASSGUID, e.Object_Type AS CLASSTYPE, e.Name AS Name, e.ea_guid AS ea_guid, e.Object_ID AS Object_ID
If I run this in the 'Find in Project' (ctrl+f), right-click the element and generate documentation with my template everything works as expected.

But when I apply this search on a model document, with OBJECT_ID, and generate documentation on the model document I get a blank page.

In my template I am trying to list embedded elements.


Why does it work when I generate directly from the element in 'Find in Project', but not through the model document 'SearchName' and 'SearchValue'?

Any ideas?

Thanks!

10
Hello!

I wanted to try out a scriptlet and want to add all childPackges in a diagram.

The setup:

Package contains childPackages and a diagram.
The scriptlet should add all the childPackages on the diagram.

The scriptlet:
Code: [Select]
function addPackagestoDiagram()
{
Repository.ClearOutput("Script");
Repository.EnsureOutputVisible("Script");

var currentDiagram as EA.Diagram;
var diagramPackage as EA.Package;
var childPackages as EA.Collection;
var diagramObjects as EA.Collection;
var diagramObject as EA.DiagramObject;
var currentPackage as EA.Package;

currentDiagram = Repository.GetCurrentDiagram();
diagramPackage = Repository.GetPackageByID(currentDiagram.PackageID);
childPackages = diagramPackage.Packages;
diagramObjects = currentDiagram.DiagramObjects;

for (i = 0; i < childPackages.Count; i++)
{
currentPackage = childPackages.GetAt(i);
diagramObject = diagramObjects.AddNew("","");
diagramObject.ElementID = currentPackage.Element.ElementID;
diagramObjects.Update();
diagramObject.Update();
}

currentDiagram.Update();
 

}
addPackagestoDiagram();

This line:
Code: [Select]
diagramObject.ElementID = currentPackage.Element.ElementID;

yields diagramObject is undefinied.

I've been looking at:
https://sparxsystems.com/forums/smf/index.php?topic=39128.0
and that is how it's done.

I've also tried changing
Code: [Select]
diagramObject.ElementID = currentPackage.Element.ElementID;
to
Code: [Select]
diagramObject.ElementID(currentPackage.Element.ElementID);
as in the linked thread.

But the problem occurs either way, giving diagramObject is undefinied.

What am I missing? 🤔

Thanks!

11
Hello!

I have a problem similar to:
https://www.sparxsystems.com/forums/smf/index.php/topic,43909.0.html

-> My text in Element.Note is XML-escaped and therefore replace characters with HTML-number (?) like &#229;

But I have my query in a ModelView, and therefore no template to add custom field.

I find my element(s) with a query and want to print Element.Note.

I want the Element.Note column to show formatted text. I tried a lot of different stuff.

Code: [Select]
Element.Note AS [Note-Formatted]
Element.Note AS '[Note-Formatted]'
Element.Note AS [Note.Formatted]
Element.Note AS '[Note.Formatted]'
Element.Note-Formatted AS 'Notes'
Element.[Note-Formatted] AS 'Notes'
Element.[Note.Formatted] AS 'Notes'

I'm getting lost 😇

NOTE: this is a local QEAX-file.

I think I solved this one time somewhere, but can find how I solved it, or found the source to that solution. With this thread I'll know where to go!

Thank you for your time!

12
Hello!

I did a SQL query in the query builder and when I got my desired result I plugged it in my Excel-export script.

For some reason the Excel output is not the same as in the query builder output. It's the third column, 'conveyed'.

Query builder:
Code: [Select]
SELECT DISTINCT source.name AS 'source', target.Name AS 'target', COALESCE(STRING_AGG(conveyedObject.Name, ', '), 'NO DATA') AS 'conveyed'
FROM t_connector AS actualLinks
INNER JOIN t_diagramlinks AS diagramLinks ON actualLinks.Connector_ID = diagramLinks.ConnectorID
INNER JOIN t_object AS source ON source.Object_ID = actualLinks.Start_Object_ID
INNER JOIN t_object AS target ON target.Object_ID = actualLinks.End_Object_ID
FULL JOIN t_xref AS x ON x.Client = actualLinks.ea_guid AND x.Behavior = 'abstraction'
FULL JOIN t_connector AS infoLinks ON x.Description LIKE '#WC#'+infoLinks.ea_guid+'#WC#'
FULL JOIN t_xref AS x2 ON x2.Client = infoLinks.ea_guid AND x2.Behavior = 'conveyed'
FULL JOIN t_object AS conveyedObject ON conveyedObject.ea_guid = x2.Description

WHERE diagramLinks.DiagramID = 2576
GROUP BY source.name, target.Name

Script:
Code: [Select]
var queryString = "SELECT DISTINCT source.name AS source, target.Name AS target, COALESCE(STRING_AGG(conveyedObject.Name, ', '), 'NO DATA') AS conveyed " +
"FROM t_connector AS actualLinks " +
"INNER JOIN t_diagramlinks AS diagramLinks ON actualLinks.Connector_ID = diagramLinks.ConnectorID " +
"INNER JOIN t_object AS source ON source.Object_ID = actualLinks.Start_Object_ID " +
"INNER JOIN t_object AS target ON target.Object_ID = actualLinks.End_Object_ID " +
"FULL JOIN t_xref AS x ON x.Client = actualLinks.ea_guid AND x.Behavior = 'abstraction' " +
"FULL JOIN t_connector AS infoLinks ON x.Description LIKE '#WC#'+infoLinks.ea_guid+'#WC#' " +
"FULL JOIN t_xref AS x2 ON x2.Client = infoLinks.ea_guid AND x2.Behavior = 'conveyed' " +
"FULL JOIN t_object AS conveyedObject ON conveyedObject.ea_guid = x2.Description " +
"WHERE diagramLinks.DiagramID = " + theDiagram.DiagramID + " " +
"GROUP BY source.name, target.Name";

// Parse query result
var queryResult as EA.Collection;
queryResult = Repository.SQLQuery(queryString);
var DOMDoc = XMLParseXML(queryResult);

// Setup arrays for export
var sourceNames = XMLGetNodeTextArray( DOMDoc, "//Row/source" );
var targetNames = XMLGetNodeTextArray( DOMDoc, "//Row/target" );
var conveyedNames = XMLGetNodeTextArray( DOMDoc, "//Row/conveyed" );

// Create headers
var header = new Array();
header = ["Source", "Target", "Information"];

// Add headers to Excel
for ( i = 0; i < header.length; i++)
{
excelSheet.ActiveSheet.Cells(1, i+1).Value = header[i];
}
Session.Output("Headers generated...");

// Add arrays to Excel
Session.Output("Exporting " + sourceNames.length + " rows...");
for ( i = 0; i < sourceNames.length; i++ )
{
excelSheet.ActiveSheet.Cells(i+2, 1).Value = sourceNames[i];
excelSheet.ActiveSheet.Cells(i+2, 2).Value = targetNames[i];
excelSheet.ActiveSheet.Cells(i+2, 3).Value = conveyedNames[i];
}

In the Excel conveyedNames is just NO DATA. But in the query builder there is data.

What's going on?

13
Uml Process / Can a requirement satisfy a requirement? (SysML)
« on: November 15, 2021, 11:12:41 pm »
Hello!

We have different requirement sources, some of the requirements overlap.

Any model element can satisfy a requirement. Can I therefore make the conclusion that also requirements can satisfy a requirement?

We want to indicate that, if we fulfill requirement A from one source, we also fulfill requirement B and C from other sources because of the overlap.

Or should this be modelled diffently? The copy-relationship? But it's not a copy.

Thank you!

14
Uml Process / Can a requirement be satisfied by several elements? (SysML)
« on: November 13, 2021, 01:42:03 am »
Hello!

We have Services linked to Service Instructions, and the latter contains requirements.

A Service Intruction is linked to 1..* Service(s).

Example:
The Service Instruction Audio and Video Communication is linked to the Service Audio Communication, but also to the Service Video Communication.

I wanted to map Service to requirement with the Satisfy relationship. But I realized that one requirement will then be satisfied by two different elements, i.e the two Services.

Is that ok according to SysML or can a requirement only be satisfied by one element?

My thought process is that when the requirement is to be verified, both services must be implemented correctly, otherwise the requirement is only partially verified? I don't know how that would work.
On the other hand the requirement will be verified through a test case, so in the end it depends on how the test case is specified/constructed. Perhaps one test case for each service, and the requirement is verified only if both test cases passes?

Testing isn't my headache but I wanted to make sure I don't model anything that might create issues in the future.

Thank you for your input!

15
Hello!

I find the Matrix Profile defined for Matrix Specifications to be a bit limiting. For instance, not to be able to use an SQL-search.

I thought, perhaps one can do more stuff to the matrix profile through the tagged value MatrixOptions and the MatrixData. I can't find documentation for this tagged value.

Code: [Select]
<MatrixData>
<Profile linktype="Nesting" source="Requirement" target="Requirement" direction="0" targetpackage="{4FAA179C-A42B-462d-AC5C-33111E7C81C5}" sourcepackage="{F2304CBA-91B1-481c-BF9A-9982BCE20276}" showsourcechildren="1" showtargetchildren="1"/>
</MatrixData>

Could someone link me to some documentation, or tell me how I can change this to my liking? These attributes are kind of self-explanitory, but what other attributes can be used?

Can I somehow change target/sourcepackage to an SQL-search here in the tagged value?

Thank you!

Pages: [1] 2 3 ... 5