Book a Demo

Author Topic: t_xref-entries by script; generation of GUIDs?  (Read 6561 times)

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
t_xref-entries by script; generation of GUIDs?
« on: October 02, 2012, 02:28:50 am »
Dear all,

I need to insert new entries into table t_xref via script - or better, I would like to subset properties automatically, and there seems to be no way to do this by using the classes from the Element Feature Package.

However, I can't insert anything into t_xref by Repositoy.SQLQuery because DAO expects a primary key in XrefID - which, in this case, is a GUID.

Is there a way to create valid GUIDs by script?

Thanks for any suggestions.

Michael





Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: t_xref-entries by script; generation of GUIDs?
« Reply #1 on: October 02, 2012, 02:41:24 am »
OK... - Repositoy.SQLQuery works only with SELECT statements. Anything else I can do?  :(

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: t_xref-entries by script; generation of GUIDs?
« Reply #2 on: October 02, 2012, 03:26:28 am »
Repository.Execute (insert_or_update_sql);

Undocumented and unsupported, but works.

q.

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: t_xref-entries by script; generation of GUIDs?
« Reply #3 on: October 02, 2012, 04:23:29 am »
Ah, thanks a lot, qwerty; that's a big help!

But the Primary Key issue still troubles me.

Any hints?

M.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: t_xref-entries by script; generation of GUIDs?
« Reply #4 on: October 02, 2012, 09:28:28 am »
Quote
or better, I would like to subset properties automatically, and there seems to be no way to do this by using the classes from the Element Feature Package.

From the release notes for EA 9.3.935:
Quote
Automation Interface for Attributes now provides properties for SubsettedProperty and RedefinedProperty
Install the latest build of EA and try using SubsettedProperty on the EA.Attribute class.  Is that what you were looking for?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: t_xref-entries by script; generation of GUIDs?
« Reply #5 on: October 02, 2012, 05:27:37 pm »
Michael,

In most places EA uses standard GUID's, which you can generate from a whole host of libraries or databases.

A google search for GUID + your scripting language/database should get you a solution quickly.

Geert

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: t_xref-entries by script; generation of GUIDs?
« Reply #6 on: October 02, 2012, 06:30:28 pm »
Aaron, Geert,

I really love this forum. You always get answers (quickly), and they always prove helpful.

Thanx a lot!

Michael
« Last Edit: October 02, 2012, 06:31:25 pm by hafnerm »

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: t_xref-entries by script; generation of GUIDs?
« Reply #7 on: October 09, 2012, 03:58:37 am »
Note to self :-)

sub main
      dim objTypeLib  
      dim strNewGUID
      Set objTypeLib = CreateObject("Scriptlet.TypeLib")  
      strNewGUID = objTypeLib.Guid
      Session.Output strNewGUID
end sub