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.


Messages - steverumsby

Pages: [1] 2
1
Is there a way to launch a script from a diagram? - e.g. a link in a diagram in a report package.

I often need to run a script before generating a report and it would be easier visualize this by including the invocation in the report packages somehow.
There isn't as far as I know. As Geert said you can add the script to a "Diagram" group and then run it from the context menu, but that's not a nice UX (the "Scripts" menu isn't at the top level, and it has no structure so if you have lots of diagram scripts it can be hard to find the one you are looking for). For relatively quick scripts that you want to always run you can use a scriptlet, but if the script takes a while, or you don't want it to always run when you open a diagram, that doesn't work.

There are some cases where I'd like to have a button on the diagram that runs a script. I don't know of a way to do that - is there one?

Steve.

2
In 16.1.1628 !INC can be used in scriptlets but I found that the scriptlet is not stopped at the end of the script, which causes an error the subsequent times the scriptlet is run
I've been using !INC in scriptlets since it became possible and I've never noticed this problem. What do you mean by "the scriptlet is not stopped"? What are the symptoms?

3
Thanks Steve, I am sure that Ian's eaSheets has better functionality. Other than the additional cost, on top of Sparx EA and PCS, the biggest 2 issues for us are accreditation and whether eaSheets can work through PCS (instead of direct database connection).

Why it is down to the good work of people like Ian or Geert to get a decent way to get data into Sparx EA via Excel or even word is beyond me. Sparx Systems should be investing in this or buying Ian's or Geert's code and developing it further.

An issue we constantly is that, although we can write scripts, we often do have time constraints that stop us from writing scripts.

This conversation is drifting a bit now, and should probably end up in a different thread if it continues! I have conflicting thoughts about all this. On the one hand it makes sense to me for Sparx Systems to focus on what they do well and allow partners to fill in any gaps. A flourishing partner ecosystem is good for everyone. An accreditation system is an important part of that, allowing people to buy partner products in confidence. I don't think having a "3rd party extensions" page (https://sparxsystems.com/products/3rdparty.html) is that, although I suppose it is better than nothing. Accreditation ultimately adds to cost, though, as partners and Sparx will end up with more work to do.

But I agree at some point, when a functionality gap becomes something everyone expects then Sparx needs to somehow start providing that functionality, and acquiring and integrating a partner product continues to support the partner ecosystem in a way that building their own does not. (I do realise it isn't that simple :) )

I understand the script writing issues. I'm operating largely as a one man EA band at the moment, and so I can live with scripts that get the job done and don't have to be as robust as they would need to be if used within a larger team. That reduces the amount of time I need to spend on them. Plus I enjoy writing code, so it makes me happy! But that's just me and my situation. I'm glad the facility is there, but I understand why not everyone can make use of it.

4
The MS Office integration you get with the Ultimate version of Sparx EA allows the creation of connectors I believe. I don't have it so I don't have first hand knowledge of how it works, I'm afraid.
It does but it is a bit clunky, essentially, the way the sample import spreadsheet is structured implies that the elements need to be imported before before any relationship scan be created.

It isn't something I do often enough to consider buying it, and now that I know it is clunky I'm less inclined to do that! Anyway, I suspect that creating the connectors with a script gives me more flexibility to create exactly what I want. Of course, I'm happy writing code and I know not everybody is.

I think the eaSheets module from eaTeamWorks has much better excel importing capabilities. If this is something you do a lot, and/or don't like writing code, that is probably work a look - https://www.eateamworks.com/. I'm sure Ian Mitchell can comment further...

Steve.

5
The MS Office integration you get with the Ultimate version of Sparx EA allows the creation of connectors I believe. I don't have it so I don't have first hand knowledge of how it works, I'm afraid.

What I have done in this situation is to import the elements in the way you have done (I use the standard import rather than Geert's, but the same idea) and as part of the import create tags on those elements indicating which existing elements they should be connected to. You must have that in your source data in some form. Then I write a script to find these imported elements and create the connectors to existing ones based on the information in the tags. The script can remove the tags afterwards if you no longer need that information.

6
PCS General Board / Re: PCS performance
« on: November 09, 2023, 11:40:29 pm »
What Geert said!

My experience is exactly the same. When accessing from home (500Mbps down, 70 up but with a VPN in the way slowing everything down), PCS is noticeably faster than direct DB access (PCS is batching/optimising the DB accesses I assume?). But also, API access is just slow. You maybe don't notice on a Gbps internal network, but it just is. For read access I have converted all my code to use SQL queries, and that speeds things up by 10-20 times, maybe. Things that took minutes now take seconds.

Updates I still do through the API, obviously, and there's generally less of that (for what I do) so the slowness is less important. Occasionally, though, I'll have a script that sits and runs for 10or 20 minutes, sometimes longer, because it is doing a lot of updates.

Steve.

7
What is your script doing? It would be easier to help if you tell us a little more. There might be faster ways to do what you are doing.

For example, if you are using pure API access to get at the contexts of your model you will likely find that using SQL to read will be *much* faster. You'll still want to use API access to write any changes. I've reduced script runtimes from minutes to seconds once I realised this.

STeve.

8
General Board / Re: Gitflow like diagram without using Lemon Tree
« on: July 11, 2023, 12:32:04 am »
I think you could do this easily enough with a "whiteboard" diagram.

Steve.

9
Yes, you definitely need the diagramObject.Update statement.

You don't need a Diagram.Update() statement is what q. suggested.

I misunderstood. Sorry! In fact I don't have a Diagram.Update() so by accident has discovered I don't need it  :D

Yes, it looks like storing the colour value (or at least a simple value that will determine the colour) and then using that in a legend is the way to go.

Thanks all. Advice much appreciated.

Steve.

10
Probably. You likely only want a Reload of the diagram, rather than an update. (Always hard to tell without seeing a source.)

q.

The source is a little complicated, but is effectively something like this:
Code: [Select]
for(d in diagramobjects) {
    var c = calculateAColour(diagramobjects[d])

    diagramobjects[d].BackgroundColor = c
    diagramobjects[d].Update()
}
If I call the "Update()" method the scrips takes a lot longer. If I don't, the visible diagram doesn't change. If I add a call to "Repository.ReloadDiagram(diagramID)" the visible diagram still doesn't update. If I manually reload the diagram after the script has finished, it still doesn't change. It seems like I really need the "Update()" call?

Steve.

11
Hi Steve,

We normally create Heatmaps with a dynamic Legend based on the Tag value.  Is there a reason why you didn't take that approach?  That seems to be quicker, we've had maps of over hundreds of items that don't seem overly slow.

HTH,
Paolo

The colouring in this particular heatmap is not based directly on the tag value but on a calculation using the tag value. Specifically the tag value is a date (when maintenance ends for this element) and the colouring is based on the relationship of that date to today - red for in the past, orange for in the next 12 months, etc. So I don't think a dynamic legend would work for this.

I suppose I could store the result of that calculation in another tag and build a dynamic legend from that. That might work better. Hmmm.... Thanks for the idea!

Steve.

12
You don't need to update the diagram object if you just alter the diagramObjects! Update the diagram object only if you alter its properties (like name, flags, etc.).

q.

Not sure what you mean. If I don't call d.Update() on the diagram object after the script changes its background colour, the displayed diagram doesn't change. Am I completely misunderstanding something? Always possible - I'm fairly new to Sparx EA!

Steve.

13
I have a diagram script (Javascript) that creates a heatmap by colouring diagram objects based on a tag value. This isn't a simple diagram (containing a little over 60 objects), and the script runs in just under 20 seconds. However, if I comment out the "d.Update()" line in the code so the diagram object just doesn't get updated, the runtime drops to under 5 seconds. In other words, 15 seconds of the 20 second runtime is simply processing the diagram updates.

I'm wondering if there's a trick to make this happen more quickly? Can they be batched so they all happen at once? It is quite nice, maybe even hypnotic(!),  to see the elements changing colour one at a time but I'd happily give that up if I could make it all happen faster. Any suggestions?

This is EA 16.05 connecting via PCS 1.05 to an MSSQL DB. The connection to PCS is via a VPN (when I'm at home and not in the office) and that does affect the runtime somewhat. The times would all be much shorter with a proper wired network to the server, but I'm an home much of the time so VPN it is...

Thanks,
Steve.

14
Bugs and Issues / Re: Cannot insert duplicate key in object 'dbo.t_seclocks'
« on: September 20, 2022, 11:37:00 pm »
I had figured out that it was something to do with diagram locks, and let Sparx know about that, but I haven't found a way to reliably reproduce it for me. When ever I try, sometimes it happens, sometimes it doesn't. Sometimes I can change one thing and that's fine but changing (or adding) a second triggers the message. Sometimes it is the third. It is very frustrating!

If you can trigger it reliably then for sure that will help them track it down. 🤞

Steve.


15
Bugs and Issues / Re: Cannot insert duplicate key in object 'dbo.t_seclocks'
« on: September 14, 2022, 07:08:26 pm »
I am getting the same thing. I have reported it to Sparx but they have no solution yet. We have had a few back and forth emails trying to figure it out. All they can say so far is that there's no model corruption going on so it is safe to ignore the error.

I suggest you report it to Sparx so they know it isn't just me that has this problem!

Steve.

Pages: [1] 2