I got this to work... it was the ';' that I left out!! :-)
 
It works like a champ! Thanks!
 
-Brandon


From: Axapta-Knowledge-Village@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Malcolm Burtt
Sent: Tuesday, July 05, 2005 12:03 PM
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] Adding Built in Functions

Hi
 
I've just created the following method on the global class....
static str myfunc(str s)
{
    return s + "TEST";
}
...and called it in the following job...
 
static void Job54(Args _args)
{
    ;
    print myfunc("Hello world");
    pause;
}
Both compile and run fine. Maybe you fell foul of Axapta's "end of declarations section" quirk (i.e. try adding a ";" on the line before your function call as I have.
 
Regards
 
Malcolm
-----Original Message-----
From: Axapta-Knowledge-Village@yahoogroups.com [mailto:[EMAIL PROTECTED]On Behalf Of Brandon George
Sent: 05 July 2005 16:44
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] Adding Built in Functions

Well,
 
 I tried to add the following Method:
 
static str MMI_Test(str s)
{
    s = s + "TEST";
    return s;
}
 
And tried
    
     myval = MMI_Test("a");
 
From a Job, and it tells me that the function is not declared. I do a Global:: to try and find it, and it's not there for use. I don't want to have to do a Global:: anyway, so can anyone tell me for sure if I can add a method / function somewhere so I can get the same ability as a built-in function?
 
( ex: myval = myFunc("test"); )
 
thanks,
Brandon


From: Axapta-Knowledge-Village@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Malcolm Burtt
Sent: Tuesday, July 05, 2005 11:29 AM
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] Adding Built in Functions

Hi Brandon
 
If I understand your question correctly then the answer is is yes.
 
Add your function as a method on the class called global (you'll find that right at the bottom of the list of classes in the AOT) and you can refer to it in code in the same way as kernel functions. e.g.
 
    myval = myfunc(1,2);
 
Regards
 

Malcolm Burtt
Global IT Group
"Business Solutions designed for YOUR business processes"
Global IT Group is the trading name of Touchstone Global Business Solutions Ltd. and is part of the Touchstone Group PLC.

-----Original Message-----
From: Axapta-Knowledge-Village@yahoogroups.com [mailto:[EMAIL PROTECTED]On Behalf Of Brandon George
Sent: 05 July 2005 16:28
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: [Axapta-Knowledge-Village] Adding Built in Functions

Hello All!
 
 I tell you I am just filled with questions!! ;-)
 
Anyway I do have a question for everyone. I am sure through everyone's development you all have used the Built-in functions like: substr(), or strfmt(), or str2int().
 
Anyway I am wondering if there is anyway you can add your own custom (built-in) functions? I know the keyword here is 'built-in' but for sake of typing, which is the goal here, I have a good bit of methods that do similar but different things to strings, etc. that I would like to be able to expose to All Jobs / Classes / Forms, etc. without having to make them a Static of a Class or a Method of a class. Like the Built-in Functions.
 
So I was wondering is there anyway to create a Method / Function that can be called the same way as substr() is, without a reference to a specific class?
 
If not I understand, and I believe you Can't do this, but I figure it's worth the time to ask and see if anyone has been able to do such a thing, and if so how?
 
thanks,
Brandon


Sharing the knowledge on Axapta.



Sharing the knowledge on Axapta.



Sharing the knowledge on Axapta.



Sharing the knowledge on Axapta.



Sharing the knowledge on Axapta.



YAHOO! GROUPS LINKS




Reply via email to