Book a Demo

Author Topic: Show/Hide Gateway Label via VBScript/SQL/Other  (Read 6629 times)

cjcrystal

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Show/Hide Gateway Label via VBScript/SQL/Other
« on: June 30, 2017, 12:55:42 pm »
Hi Community,

I would like to kindly ask if there is a way to call the
[Hide Label] functionality via VBScript , to target all Elements of type Gateway,
across Diagrams under a Package.

if not, can this be done via SQL script, or via Other technique?

Thank You in advance.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Show/Hide Gateway Label via VBScript/SQL/Other
« Reply #1 on: June 30, 2017, 05:19:19 pm »
Since you're asking for a SQL, you can update t_diagramlinks and alter the text HDN=0; to HDN=1; in the Geometry field. That would be the easiest change a whole diagram.

In scripting you need to get DiagramLinks for the diagram and alter the above text in the same way.

In both cases you should close/open the diagram to see the changes. Remember that on closing the diagrams EA might ask to save changes. Eventually you should force that in the start of your script.

q.

cjcrystal

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Show/Hide Gateway Label via VBScript/SQL/Other
« Reply #2 on: June 30, 2017, 05:48:24 pm »
thank you qwerty,

I can now  target all Diagram Links within a Diagram with this,

 HDN=0:BLD=0:ITA=0:


Is there a way to target objects  Elements within the Diagram, such as a Gateway's name/label? Does it also have a Geometry attribute?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Show/Hide Gateway Label via VBScript/SQL/Other
« Reply #3 on: June 30, 2017, 06:14:48 pm »
Just help me out: how can I create a Gateway?

q.

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Show/Hide Gateway Label via VBScript/SQL/Other
« Reply #4 on: August 01, 2017, 07:50:41 pm »
Be aware that not every connector has a diagram link row by default. This is yet another inconsistency to diagram objects. Before changing the diagram link via SQL make sure that the diagram link for your connector and specific diagram really exists. If this is not the case, you can create the link via code.

We do this for similar use cases (in this case bend point application to connectors) like shown below. The importance piece is the logic plus the insert query, which took me quite some time to get it accepted by EA.

Code: [Select]
        public void changeConnectorLayout(IDualConnector conn, int diagramID, IEnumerable<Point> bendPoints = null)
        {
            string diagramLinkAvailableQuery = "SELECT ConnectorID FROM t_diagramlinks WHERE ConnectorID=" + conn.ConnectorID + " AND DiagramID=" + diagramID;
            string linkAvailable = EAFacade.RetrievalCore.getFieldByQuery(diagramLinkAvailableQuery, "ConnectorID");
            if (linkAvailable == null)
            {
                string insertDiagramLinkSQL = "INSERT INTO t_diagramlinks(DiagramID, ConnectorID, Geometry, Style, Hidden) " +
                    "VALUES(" + diagramID + "," + conn.ConnectorID + @",'EDGE=1;$LLB=;LLT=;LMT=;LMB=;LRT=;LRB=;IRHS=;ILHS=;','Mode=3;Color=-1;LWidth=0;Tree=OR;',False)";
                EAFacade.rep.Execute(insertDiagramLinkSQL);
                changeConnectorLayout(conn, diagramID, bendPoints);
            }
            else
            {
                ConnectorLayout layout = new ConnectorLayout(conn.ConnectorID, diagramID);
                layout.Create();

                string newStyleSQL = layout.GetStyleDBString();
                string newGeometrySQL = layout.GetGeometryDBString();
                string newBendPoints = layout.SetBendPoints(bendPoints.ToList());

                string setBendPointsSQL = "UPDATE t_diagramlinks SET Style='" + newStyleSQL + "', Geometry='" + newGeometrySQL + "', Path='" + newBendPoints + "' WHERE DiagramID=" + diagramID + " AND ConnectorID=" + conn.ConnectorID;
                EAFacade.rep.Execute(setBendPointsSQL);
            }
        }

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Show/Hide Gateway Label via VBScript/SQL/Other
« Reply #5 on: August 01, 2017, 09:26:45 pm »
This is true. However, I have the feeling that the later EA versions create a diagram link in call cases. If a diagram link is missing EA simply renders a default connector, though.

q.