Normal Topic User Defined Function (UDF) (Read 680 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
User Defined Function (UDF)
Apr 4th, 2005 at 5:22pm
Print Post Print Post  
Looked at Carl's UDF that he posted in Sample Application. I liked it very much and hopefully this will inspire other people to make their own UDF library and post them here for others to use. I liked the way it he used "@" in front to make it clear it is function and it returns value. However in order to differentiate it from other hard-coded functions, I would name UDF ending with udf, more like @Pad_UDF (  ).

Initially I thought that one will have to make @Trim_UDF ( ) to remove leading and trailing spaces when lookup done or used in some other string operations or when they are printed. But to my pleasant surprise, Sesame removes the spaces automatically and that probably explain why @trim ( ) is not hard-coded.
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: User Defined Function (UDF)
Reply #1 - Apr 4th, 2005 at 10:27pm
Print Post Print Post  
Good observation. You're absolutely correct in your assumption as to why I used the "@" symbol at the start of the function name.

I did consider naming it something like @cuPad (for CUstom or possibly my initials Wink). But the reason I didn't put some additional indicator to identify it as a custom function, is because the whole point of that particular function was to simplify and shorten the amount of code that I had to repeatedly type, which can become tedious and make it difficult to follow the WriteLn entries.

I suppose that we should make a habit of labeling them somehow, or else we might find ourselves spending time debugging only to finally remember we are trying to use a custom fuction. Grin
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged