Book a Demo

Author Topic: UDF support?  (Read 3028 times)

smorgan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
UDF support?
« on: September 26, 2008, 02:15:32 am »
I have looked everywhere in the forum and help, but I cannot seem to find anything about how to define user-defined functions. I've been able to define and create stored procedures just fine, but not UDFs.

Any help would be great appreciated. Thank you in advance...

Best regards,
Scott Morgan

smorgan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: UDF support?
« Reply #1 on: September 26, 2008, 03:01:32 am »
Well, after further trial and error, I have figured this out. I thought I'd share what I did in case someone else may find it useful.

  • Within the IDE, select Settings | UML menu options
  • Click the New button and type in the following values:

         Sterotype: functions
         Base Class: class
  • Click the Save button
  • From the toolbox, drag a class instance to your diagram. Give it a name and then for its stereotype, select "functions" from the list, then click the OK button.
  • Double-click the class to bring the properties dialog back up. You should now see a tab titled "Function Detail". Select this tab.
  • Click the Function Definition button.
  • From this dialog, you can define as many UDFs as you need. Be sure to give each UDF a stereotype of "func". Click on the Behavior tab and insert the actual UDF code within the "Initial Code:" edit box. One difference here, at least for SQL Server, you actually need to put in the full definition of a UDF including the CREATE FUNCTION statement.


What I've described above seems to work fine for me so far. I hope this proves useful for someone else and saves them the frustration I've gone through. Thanks for reading...

- Scott

[/list]
« Last Edit: September 26, 2008, 03:03:58 am by smorgan »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: UDF support?
« Reply #2 on: September 26, 2008, 07:49:33 am »
Well done Scott!

You seem to have found a parallel to the way EA handles stored procedures. So far you have something that works like the container class paradigm EA uses for stored procedures.

For stored procedures this has been around for a while. There is a newer method you can use, that creates a separate class for each stored procedure. Have you tried doing the same with a UDF, and if so does that also work?

You'll find a reference to this in the EA help index under Stored Procedures | As individual Class. Both methods are shown on the page indexed as Stored Procedures | Definition. I don't find any reference to UDF definition anywhere.

[My suspicion, completely naive, is that this might be an initial foray into UDF support, but not yet formally a tested and announced (or even supported) feature.]

David
No, you can't have it!

smorgan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: UDF support?
« Reply #3 on: September 26, 2008, 08:03:01 am »
Hi David,
Thank you for the kind words; I did try the method of creating separate classes like sprocs, and that seems to work as well. It's nice to see there are ways to work around hurdles within EA. That is a testament of the great product it truly is.

Now I'm off to conquer creating user-defined data types in EA; if I figure that out, I'll post that too. :) Thanks again!

Best regards,
Scott

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: UDF support?
« Reply #4 on: September 26, 2008, 09:27:18 am »
Hi Scott

For user-defined data types, try starting with this:

http://www.sparxsystems.com.au/EAUserGuide/index.html?datatypes.htm
Best Regards, Roy