Author Topic: Automatically Change the setting of ShowForeign in Diagram Properties via VBA  (Read 290 times)

JamesM

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
I'm creating a VBA script to automatically establish a standard set of diagram properties.  I am unable to find how I can set the value for ShowForeign, as it is known in t_diagram, or Show Namespace as it is displayed within the tool.  Can anyone assist with the syntax necessary to achieve this.

qwerty

  • EA Guru
  • *****
  • Posts: 11388
  • Karma: +295/-262
  • I'm no guru at all
    • View Profile
t_diagram.showForeign

(from p. 13 of my Inside book)

Code: [Select]
repository.execute("UPDATE t_diagram SET showForeign = 1 WHERE diagram_id = <theId>")
Not sure about the VBA syntax. Maybe you need to omit the parentheses.

q.
« Last Edit: July 30, 2020, 01:15:27 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10403
  • Karma: +342/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Code: [Select]
repository.execute("UPDATE t_diagram SET showForeign = 1 WHERE diagram_id = <theId>")
Not sure about the VBA syntax. Maybe you need to omit the parentheses.

In theory yes. You are only supposed to use parentheses when you are doing something with the return value.
So
Code: [Select]
a = function("parameter")is OK
Code: [Select]
function("parameter")
is not supposed to be OK, but in this case you don't get an error. It's only if you have more than one parameter the you get a syntax error.
Code: [Select]
function("parameter1", "parameter2")
This should be written as
Code: [Select]
function "parameter1", "parameter2"

(Yes I agree, that is a weird ass syntax :-X)

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7290
  • Karma: +84/-12
    • View Profile
It's only if you have more than one parameter the you get a syntax error.
Presumably because it ends up being a parenthesized expression instead of parenthesis around the arguments.
Eve

support@sparxsystems.com