Automating ER/Studio from Delphi 2009 - Translating build-in macros to Delphi

Posted by on in Blogs
This is a post for my beloved Grzeniuś:-).

I have change the describtion of my blog to "Delphi Programming" and added "Delphi Programming" category. Watch out TIOBE index! Delphi is strongly rising.

The SDC conference this week was very good and Delphi track was very rich and interesting. In the evening, at the first conference day, during relaxed "Delphi Tips & Tricks" session with Bob Swart and Nick Hodges I have demonstrated automating ER/Studio application in Delphi code from a Delphi VCL Forms application. The first thing is to verify that you have ER/Studio ActiveX VCL wrappers installed on Delphi Tool Palette. The process of importing ER/Studio COM type library into was described in my previous post "Automating ER/Studio from Delphi - Getting Started". The left pane in the main ER/Studio window has got 5 tabs. On the "Macros" tab there is big collection of VBA macros installed "out of the box".



Here is the source of the "Auto-Create New Diagram" macro:



Just drop a "TApplication" component from Delphi Tool Palette on the form and execute the following Delphi code:



The translation is slightly modified. "aEntity" variable stores a reference to the first entity added so it is not neccessary to obtain it again. Executing this code will generate the following ER/Studio diagram



That’s interesting and gives a power of controlling powerful ER/Studio functionality from Delphi code.


About
Gold User, Rank: 9, Points: 364
Crazy about Delphi Programming!

Comments

  • Guest
    Per Bakkendorff Saturday, 11 October 2008

    Nice.
    However, IMHO I prefer the ECO approach. I control, not how the physical layout in the database is, but how the model is represented in my code, without any plumbing to access that model.
    With ECO, I don't care how the database look at the table level. I find that very appealing.
    Unfortunately it's doesn't seem like Embarcadero is interested in ECO, but instead pushes their existing product(s) :(
    Prove me wrong, Embarcadero :)

  • Guest
    Pawel Glowacki Saturday, 11 October 2008

    @Per,
    In my opinion there is room for both approaches. ECO is more application oriented and more like OR layer. There are situations that you care about internal db metadata to make sure that all queries are optimized, then DG-like tools are the most valuable.
    Paweł

  • Guest
    Per Bakkendorff Saturday, 11 October 2008

    @Pavel,
    I know the difference, and I agree; there are room for both.
    That was not my point. My point was, that I haven't seen/read anything in the news regarding ECO.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: