Book a Demo

Author Topic: Generate EA GUID  (Read 10498 times)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Generate EA GUID
« on: December 11, 2007, 12:43:02 pm »
In a table like t_object, there is a column for EA_GUID.  If I want to create code to create new entries in this table, is there a way to generate these?

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Generate EA GUID
« Reply #1 on: December 11, 2007, 02:32:11 pm »
GUID values are automatically generated if you are adding new items via the Automation Interface.  If you are directly inserting into the database, you would need to use a Windows API call like CoCreateGuid to generate a valid GUID for you to insert.

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Generate EA GUID
« Reply #2 on: December 11, 2007, 02:53:43 pm »
Yes, I am talking about straight into the DB.  The language I will be using for the insert has a GUID function.  So, I can use that ... independent of whatever scheme that EA is using on its own?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Generate EA GUID
« Reply #3 on: December 11, 2007, 03:11:04 pm »
Hi Thomas,

You can do what you describe. Create the new element (or whatever) as you normally would, with the appropriate AddNew syntax. Then, before you call Update, assign your application-created GUID to the GUID property. You'll need to convert the GUID to a string, with correct formatting; you can get the correct format by reading the GUID property of some existing element.

When you call Update on a new element, EA checks to see if there is already a valid GUID. If so, EA uses that value. If not, EA creates a new value and uses that. Either way, once Update is called the first time, EA treats the GUID field as read only from that time on.

HTH, David
No, you can't have it!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Generate EA GUID
« Reply #4 on: December 11, 2007, 03:47:07 pm »
Well, I don't know what you mean by "call update".  I am going to be doing this from an ABL program directly into an OpenEdge database repository.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Generate EA GUID
« Reply #5 on: December 11, 2007, 04:16:02 pm »
Sorry Thomas,

You've written about this often, but I seem not to have gotten the point.   :-[

Just set the database field to your application-generated GUID. As I mentioned above, remember to convert the GUID to a string, and use the same formatting convention as EA does.

David
No, you can't have it!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Generate EA GUID
« Reply #6 on: December 11, 2007, 04:21:52 pm »
OK, that I think I can handle ... including the explosion when I don't get it right the first time!

Sure wish I had that insider's guide to the schema which has been discussed ...

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Generate EA GUID
« Reply #7 on: December 11, 2007, 05:25:13 pm »
Quote
...Sure wish I had that insider's guide to the schema which has been discussed ...

Back in the 6.5 days I hoped the SDK might grow into just such a thing. History shows it has not.

I'm of two minds about this. On one hand it would have been nice to have a specific project aimed at more fully documenting the mysteries of EA internals. On the other hand Roy et al have done legion work to improve the quality and relevance of the overall documentation package. Reintegrating the SDK into the main package has allowed these to stay in sync. Given the enormity of the task (detailing the entire EA documentation suite) I can see the wisdom of restricting the fan-out until things settle down.

Still, if only...

David
No, you can't have it!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Generate EA GUID
« Reply #8 on: December 11, 2007, 05:38:48 pm »
Seems like there should be an EAP file around somewhere ...