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 - Mr Stuff

Pages: [1] 2 3 ... 5
1
Thanks but I don't understand - a bit too terse for me.

a) You said Package_ID is Int, implying drop the tick marks, but I as I said I tried both with and without tick marks and it made no difference, so how/why does the string/int issue affect the repository.SQLQuery but not the scratchpad?

b) You said I need a GROUP BY...
    i) I only want a single number, the count, not the Count and Object_ID that you added, in which case GROUP BY seems redundant ;) How should adding Object_ID to the select help?
   ii) The query was perfectly OK exactly as quoted in the scatchpad so again, GROUP BY is redundant - at least in the scratchpad. If it is needed for repository.SQLQuery can you say why?

Hence the question: why is ok in the scratchPad but not via repository.SQLQuery?

What am I missing here?

J

2
I've developed Geert's code to provide a string of Package_ID's suitable for SQL and I have the query string...

Code: [Select]
SELECT COUNT(Object_ID) FROM t_diagramobjects INNER JOIN t_diagram ON t_diagramobjects.Diagram_ID = t_diagram.Diagram_ID WHERE t_diagram.Package_ID IN ('3982','4482','7922','4483','6882','6722','7062','7103')
However, whilst this works from the SQL scratchpad, returning the same answer as obtained with (#Branch#) in the IN clause, if I actually use that string with repository.SQLQuery I get (via Session.output

Code: [Select]
<?xml version="1.0"?>
<EADATA version="1.0" exporter="Enterprise Architect">
<Dataset_0><Data><Row/></Data></Dataset_0></EADATA>

and EA complains...

Error:
Code = 0x0
Source = Line : 0; Char : 0
Error description = (null)

NB Removing the tick marks around the numbers in the IN clause gives the same results

Anyone have any idea why this is not working?

J

3
Now when using SQL searches you can use the macro #Branch# to get all package ID's of the currently selected package and all nested packages. Because that macro can't be used in scripting I'm making the package ID string myself.

I found the answer in Geert's post above; I'll try to follow his approach...

Julian

4
OK, I've wrapped the query in a script to use Repository.SQLQuery

But I think EA is objecting to (#Branch#) [actually failing on the #] in the sql text...

Can (#Branch#) be used in a direct query to Repository.SQLQuery or only from the front end?

Thx, Julian

5
Hmmm.... This actually seems to work, on the basis that it went up by 1 when I added an object to one diagram ;)

Code: [Select]
SELECT COUNT(*)
FROM t_diagramobjects
INNER JOIN t_diagram ON t_diagramobjects.Diagram_ID = t_diagram.Diagram_ID
WHERE t_diagram.Package_ID IN (SELECT Package_ID from t_package where Package_ID in (#Branch#))

So, final question is: how do I reference (#Branch#) from e.g. the GUID of a specific package so I don't  have to select it in the browser?

Julian

6
@qwerty said "not in the scratchpad" - in fact that's where it does work :)

Next steps?

7
Referring to the user guide http://www.sparxsystems.com/enterprise_architect_user_guide/13.0/model_navigation/creating_filters.html

I selected my chosen root package in the project browser and entered
Code: [Select]
SELECT * from t_package where package_id in (#Branch#) in the <search term> box and ran the query by clicking the "play" type button (with no tooltip)

Nothing happened. Repeated in front of witnesses, tried adding ";" at the end, and capitalising as
Code: [Select]
SELECT * FROM t_package WHERE Package_ID IN  (#Branch#)
Still nothing

And even if I get that part working from a follow-up answer, what do I do next?  :(

Sorry for being such a plodder...

Thanks

Julian

8
I don't do SQL so this is hard ;)

I would like to count all the diagram objects on all diagrams in all sub-packages of a specified root package.

I think it should be simple  - I tried building up from "... FROM t_package START WITH ea_guid = '{AF3FBF07-CEC4-49f4-8E84-D2CCB146B4BA}' " but then ran out of steam as CONNECT BY Parent_ID = Package_ID just gives me my root package.

Ignorance is not bliss... all assistance gratefully received!

Thx, Julian


9
Automation Interface, Add-Ins and Tools / Re: Script Prompt Position
« on: July 31, 2017, 07:41:11 pm »
I also had problems with Session.Prompt placing the box in odd places and now use vbscript inputbox for the reason Geert gave.

Just once thing... have you checked the parameter list? I have a vague recollection that one of my early errors was passing too many parameters thinking it worked like InputBox and the invalid parameters were indirectly causing bad placement.

10
Just to round things off, I accomplished my objective by a very heavy handed hack...

Script to allow user to add/edit TaggedValues on a BPMN2.0::Activity also creates/updates (edge mounted) ObjectNodes whose name is set to the TaggeValue value and presentation is controlled by a ShapeScript for the ObjectNode based on a custom stereotype.

One nice feature of this is that the Collapse Embedded Elements option on diagrams hides all this extra info if it's not required.

I do look forward to a better way of doing such things though.

Julian

11
@Simon

You mean EA will ignore the explicit XML dt tag with a formally recognised schema datatype of string and try to b64 decode and decompress anyway??? Surely EA is interested in the value and not the encoding...?

I hope we have our wires crossed because I have a hard time making sense of that :)

Julian

12
@qwerty "anyone offer..." was more of a "Does anyone have an existing...": why reinvent the wheel?

@Helmut - thank you very much; I've passed all the information to a colleague who has a development environment...

And yes to, "If I have understood you right you want to visualize a tagged value of a parent element with an Add-In used by a shape script." One can't use shapescripts on BPMN2.0 elements, but my placeholder objecnodes will not be BPMN2.0 (they'll have a custom stereotype just to trigger the shapescript to call the function to display the returned value)

Thanks for the input everyone,

Julian

13
Because I am hoping for a compiled add-in that I just, "add in". That is how it works, isn't it?

14
Hi Helmut

Thanks for the support...

A shapescript can print values of things such as #NAME# of the element to which the script applies. Shapescripts can also make use of add-in calls.

This old forum post gives examples of coding and calling http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1326759082/1#1 and I'd do it myself but I don't have a dev. environment.

What I would like to get from an add-in call in a shapescript for an embedded element such as an objectNode is the value of a named taggedvalue of the parent element (obviously a general purpose getter that did properties as well would be v. useful, but I'm primarily interested in taggedvalues).

Please let me know if any further clarification is required.

Julian


15
@KP  :) I just found that while waiting for further answers...

following fragment toggles Collapse Embedded Elements

Code: [Select]
newStyleEx = curDiag.StyleEx
if instr(newStyleEx, "CEE=1;") > 0 then
newStyleEx = Replace (newStyleEx, "CEE=1;", "")
else
' just to be safe, follow the Sparx pattern of putting the CEE=1 value just before the Theme
newStyleEx = Replace (newStyleEx, "Theme=", "CEE=1;Theme=")
end if
curDiag.StyleEx = newStyleEx
curDiag.Update
Repository.ReloadDiagram(curDiag.DiagramID)

Thanks, Julian

Pages: [1] 2 3 ... 5