How to Create Global Functions in X++
In order to create Global functions, create a new method in \Classes\Global Node. I have called mine Print Name.
{PLEASE BE CAREFUL}
\Classes\Global\PrintName
 The Code in Print Name () is shown below
static str PrintName(Str FName,Str LName,Str MName="")
{
    FName=StrDel(FName,2,STrLen(FName)-1);
    If(MName)
        MName=StrDel(MName,2,STrLen(MName)-1);
    If(MName)
        Return Fname+". "+Mname+". "+Lname;
    else
        Return Fname+". "+Lname;
}
And you've just created a global method :-)
Now Execute this job:
static void GlobalMethod(Args _args)
{
    ;
    Info(PrintName("Arijit","Basu","Kumar"));
}
The Output:




No comments:
Post a Comment