1
Automation Interface, Add-Ins and Tools / Re: Stylesheet in script generated document does not work
« on: November 04, 2021, 09:29:08 pm »
Hi, I am facing the same problem. Could you find a solution?
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.
SELECT con.Start_Object_ID AS StartObject_ID, o.Name AS StartObj_Name, con.End_Object_ID AS EndObject_ID, ob.Name AS EndObj_Name, con.Name AS ConnectionName, con.PtStartX AS Pt_StartX, con.PtStartY AS Pt_StartY
FROM t_Object o, t_Object ob, t_connector con
WHERE con.Start_Object_ID = o.Object_ID
AND con.End_Object_ID = ob.Object_ID
AND con.End_Object_ID = 17430
AND con.Connector_Type = 'Sequence'
ORDER By con.PtStartX, con.PtStartY
Hi,
In a tool like SQL Server management Studio, open a connection to your Sparx DB with an account that has permission to create views. Then wrap your CTE in a view, ie:
CREATE VIEW ChildrenAndTheirParents AS
WITH ChildrenAndTheirParents (child_ID, parent_ID, depth) AS
(SELECT t_connector.Start_Object_ID, t_connector.End_Object_ID, 0
FROM t_connector INNER JOIN t_Object
ON t_connector.Start_Object_ID = t_Object.Object_ID
AND t_Object.Object_ID = xxx
AND con.Connector_Type = 'Dependency'
UNION ALL
SELECT t_connector.Start_Object_ID, t_connector.End_Object_ID, ChildrenAndTheirParents.depth+1
FROM ChildrenAndTheirParents INNER JOIN t_connector
ON ChildrenAndTheirParents.child_ID = t_connector.End_Object_ID
INNER JOIN t_Object
ON ChildrenAndTheirParents.parent_ID = t_Object.Object_ID)
SELECT * FROM ChildrenAndTheirParents
Then in Sparx just SELECT * FROM ChildrenAndTheirParents
Regards,
Jon.
I don't know a solution, but from experience, there usually is a workaround for it.
The most common one is to find how deep your hierarchy goes, and then add a few to that. then do as many regular joins as that.
I've done that quite a few times. It's not pretty, but it works.
Geert
WITH ChildrenAndTheirParents (child_ID, parent_ID, depth) AS
(SELECT t_connector.Start_Object_ID, t_connector.End_Object_ID, 0
FROM t_connector INNER JOIN t_Object
ON t_connector.Start_Object_ID = t_Object.Object_ID
AND t_Object.Object_ID = xxx
AND con.Connector_Type = 'Dependency'
UNION ALL
SELECT t_connector.Start_Object_ID, t_connector.End_Object_ID, ChildrenAndTheirParents.depth+1
FROM ChildrenAndTheirParents INNER JOIN t_connector
ON ChildrenAndTheirParents.child_ID = t_connector.End_Object_ID
INNER JOIN t_Object
ON ChildrenAndTheirParents.parent_ID = t_Object.Object_ID)
SELECT * FROM ChildrenAndTheirParents
ORDER BY depth