Showing posts with label Microsoft Dynamics AX. Show all posts
Showing posts with label Microsoft Dynamics AX. Show all posts

Monday, 4 March 2013

Microsoft Dynamics AX 2012 R2 - cosh Function


Retrieves the hyperbolic cosine of a real number.

Argument values outside of the range –250 to 250 result in the following run-time error: "Argument for trigonometric function out of range."



Function

  • real cosh(real arg)

Parameters

  • Parameter: arg
  • Description: The hyperbolic number for which to calculate the cosine.

The value of the arg parameter must be in radians.


Return Value

  • The hyperbolic cosine of the specified number.

Example

  • X++
static void coshExample(Args _arg)
{
    real r;
    ;
    r = cosh(0.1);
    print "The hyperbolic cosine of 0.1 is " + num2Str(r, 2, 2, 1, 1);
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - cosh Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - cos Function


Retrieves the cosine of a real number.


Function

  • real cos(real arg)

Parameters

  • Parameter: arg
  • Description: The number of which to find the cosine.
 
The value of the arg parameter must be in radians.


Return Value

  • The cosine of the specified number.

Example

  • X++
static void cosExample(Args _arg)
{
    real r;
    ;
    r = cos(15);
    print strFmt("Cos of 15 is %1", r);
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - cos Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - corrFlagSet Function


Controls the correction flag for a real number.


Function

  • real corrFlagSet(real real, int arg)

Parameters

  • Parameter: real
  • Description: The number in which to set the correction flag on or off.
 
  • Parameter: arg
  • Description: 0 to set the flag to off; a non-zero value to set the flag to on.

Return Value

  • 0 if the flag is now off; otherwise, a nonzero value if the flag is now on.

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - corrFlagSet Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - corrFlagGet Function


Retrieves the state of the correction flag for a real number.


Function

  • int corrFlagGet(real arg)

Parameters

  • Parameter: arg
  • Description: The flag for which to retrieve the state.

Return Value

  • A non-zero value if the flag is set; zero if it is cleared.

Example

  • X++
The following example displays 1.
static void corrFlagGetExample(Args _args)
{
    real rr;

    rr = corrFlagSet(0.36,2);
    print(corrFlagGet(rr));
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - corrFlagGet Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - conPoke Function


Modifies a container by replacing one or more of the existing elements.

Function

  • container conPoke(container container, int start, anytype element, ...)

Parameters

  • Parameter: container
  • Description: The container to modify.
 
  • Parameter: start
  • Description: The position of the first element to replace.
 
  • Parameter: element
  • Description: One or more elements to replace, separated by commas.

 The first element of the container is specified by the number 1.

Return Value

  • The new container with the new elements.

Example

  • X++
static void conPokeExample(Args _arg)
{
    container c1 = ["item1", "item2", "item3"];
    container c2;
    int i;

    void conPrint(container c)
    {
        for (i = 1 ; i <= conLen(c) ; i++)
        {
            print conPeek(c, i);
        }
    }
    ;
    conPrint(c1);
    c2 = conPoke(c1, 2, "PokedItem");
    print "";
    conPrint(c2);
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conPoke Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - conPeek Function


Retrieves a specific element from a container.


Function

  • anytype conPeek(container container, int number)

Parameters

  • Parameter: container
  • Description: The container to return an element from.
 
  • Parameter: number
  • Description: The position of the element to return. Specify 1 to get the first element.

The conPeek function automatically converts the peeked item into the expected return type. Strings can automatically be converted into integers and real numbers, and vice versa.


Return Value

  • The element in the container at the position specified by the number parameter.

Example

  • X++
static void conPeekExample(Args _arg)
{
    container c;
    int i;
    ;

    c = conIns(["item1", "item2"], 1);
    for (i = 1 ; i <= conLen(c) ; i++)
    {
        print conPeek(c, i);
    }
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conPeek Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - conNull Function


Retrieves an empty container.


Function

  • container conNull()
Use this function to explicitly dispose of the contents of a container.


Return Value

  • An empty container.

Example

  • X++
static void conNullExample(Args _arg)
{
    container c = ["item1", "item2", "item3"];
    ;

    print "Size of container is " + int2str(conLen(c));
    // Set the container to null.
    c = conNull(); 
    print "Size of container after conNull() is " + int2Str(conLen(c));
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conNull Function' was informative. Please feel free to leave your comments.

Thursday, 21 February 2013

Ashish, congratulations! You have one of the top 1% most viewed LinkedIn profiles for 2012.

I just received an email from LinkedIn:

"Ashish, congratulations! You have one of the top 1% most viewed LinkedIn profiles for 2012"


It is good to know that my LinkedIn profile is in top 1% most viewed profiles for 2012.

Click here to view my LinkedIn profile.


My LinkedIn profile is in top 1% most viewed profiles for 2012
My LinkedIn profile is in top 1% most viewed profiles for 2012

Please feel free to leave your comments.

Monday, 4 February 2013

Microsoft Dynamics AX 2012 R2 - conLen Function


Retrieves the number of elements in a container.


Function

  • int conLen(container container)

Parameters

  • Parameter: container
  • Description: The container in which to count the number of elements.
The object parameter can be of most data types, but useful output is obtained when it is of the str or int type. Inappropriate content generates a run-time error.

Return Value

  • The number of elements in the container.

Example

  • X++
static void conLenExample(Args _arg)
{
    container c;
    int i;
    ;

    c = conins(["item1", "item2"], 1);
    for (i = 1 ; i <= conLen(c) ; i++)
    {
        print conPeek(c, i);
     }
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conLen Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - conIns Function


Inserts one or more elements into a container.


Function

  • container conIns (container container, int start, anytype element, ... )

Parameters

  • Parameter: container
  • Description: The container into which to insert elements.
 
  • Parameter: start
  • Description: The position at which to insert elements.
 
  • Parameter: element
  • Description: One or more elements to insert, separated by commas.

The first element of the container is specified by the number 1. To insert after the n element, the start parameter should be n+1.

You can also use the += operator to add values of any type into a container. For example, to create a container that contains the squared values of the first 10 loop iterations:

  • X++
int i;
container c;

for (i = 1; i < = 10; i++)
{
    c += i*i;
}

Return Value

  • The new container with the inserted elements.

Example

  • X++
static void conInsExample(Args _arg)
{
    container c;
    int i;
    ;

    c = conIns(c,1,"item1");
    c = conIns(c,2,"item2");
    for (i = 1 ; i <= conLen(c) ; i++)
    {
    // Prints the content of a container.
        print conPeek(c, i);
      
    }
    pause;

}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conIns Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - conFind Function


Locates the first occurrence of an element or a sequence of elements in a container.

Function

  • int conFind (container container, anytype element,... )

Parameters

  • Parameter: container
  • Description: The container to search.
 
  • Parameter: element
  • Description: One or more elements to search for, separated by commas.
If several elements are specified in the sequence, they must be separated by commas and specified in the correct sequence. The elements can be of any data type.

Return Value

  • Returns 0 if the item was not found; otherwise, the sequence number of the item.

Example

  • X++
static void conFindExample(Args _args)
{
    container c = ["item1", "item2", "item3"];
    int i;
    int j;
    ;

    i = conFind(c, "item2");
    j = conFind(c, "item4");
    print "Position of 'item2' in container is " + int2Str(i);
    print "Position of 'item4' in container is " + int2Str(j);
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conFind Function' was informative. Please feel free to leave your comments.

Friday, 18 January 2013

Microsoft Dynamics AX 2012 R2 - configurationKeyStr Function


Retrieves the name of a configuration key as a string.

Function

  • str configurationKeyStr(str keyname)

Parameters

  • Parameter: keyname
  • Description: The name of the configuration key.
Use this function instead of literal text to retrieve a string that contains the configuration key name. If the key does not exist, the function generates a syntax error at compile time.

Return Value

  • The name of the configuration key.

Example

  • X++
static void configurationKeyStrExample(Args _args)
{
    str s;
    ;
    s = configurationKeyStr(AIF);
    print s;
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - configurationKeyStr Function' was informative. Please feel free to leave your comments.

Friday, 11 January 2013

Microsoft Dynamics AX 2012 R2 - configurationKeyNum Function


Retrieves the ID of the specified configuration key.


Function

  • int configurationKeyNum(str keyname)


Parameters

  • Parameter: keyname
  • Description: The configuration key for which to return the ID.


Return Value

  • The ID of the specified configuration key. 


Example

  • X++
static void configurationKeyNum(Args _args)
{
    int i;
    ;
    i = configurationKeyNum(AIF);
    print i;
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - configurationKeyNum Function' was informative. Please feel free to leave your comments.

Thursday, 10 January 2013

Microsoft Dynamics AX 2012 R2 - conDel Function


Removes the specified number of elements from a container.


Function

  • container conDel(container container, int start, int number)


Parameters

  • Parameter: container
  • Description: The container from which to remove elements.
 
  • Parameter: start
  • Description: The one-based position at which to start removing elements.
 
  • Parameter: number
  • Description: The number of elements to delete.
 

Return Value

  • A new container without the removed elements.


Example

  • X++
static void conDelExample(Args _args)
{
    container c = ["Hello world", 1, 3.14];
    ;
    // Deletes the first two items from the container.
    c = conDel(c, 1, 2);
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - conDel Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - classStr Function


Retrieves the name of a class as a string.


Function

  • str classStr(class class)


Parameters

  • Parameter: class
  • Description: The name of the class to return.
Use this function instead of literal text to retrieve a string that contains the class name. If the class does not exist, the function generates a syntax error at compile time.


Return Value

  • The name of the class.


Example

  • X++
static void clStrExample(Args _args)
{
    str s;
    ;
    s = classStr(Global);
    print s;
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - classStr Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - classNum Function


Retrieves the ID of the specified class.


Function

  • int classNum(class class)


Parameters

  • Parameter: class
  • Description: The class for which to retrieve the ID.


Return Value

  • The ID of the specified class.


Example

  • X++
static void classNumExample(Args _args)
{
    int i;
    ;
    i = classNum(Global);
    print i;
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - classNum Function' was informative. Please feel free to leave your comments.

Wednesday, 9 January 2013

Microsoft Dynamics AX 2012 R2 - classIdGet Function


Retrieves the numeric identifier (the class ID) for the class of which the object is initialized.

Function

  • int classIdGet(class object)

Parameters

  • Parameter: object
  • Description: The object for which to get the class ID.

Return Value

  • The class ID of the specified object.

Example

  • X++
static void classIdGetExample(Args _args)
{
    int i;
    WorkTimeCheck w;
    ;
    i = classIdGet(w);
    print "Class ID for object is " + int2Str(i);
    pause;
}

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - classIdGet Function' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - X++ Functions


In Microsoft Dynamics AX, the X++ language provides more than 100 system functions that are not part of any class. The two types of functions are as follows:
  • Run time - functions that are executed during run time.
  • Compile time - functions that are executed during compile time.

Run Time Functions


Run time functions used for data type conversions, mathematical operations, and so on. Some common run time functions are as follows:
  • str2Int - creates an int value from a str value.
  • abs - creates a positive real value from a real value that is either positive or negative.
  • conFind - retrieves the location of an element in a container.

Call Run Time Functions from .NET
  • The logic of the X++ run time functions is also implemented in the following .NET assembly:
Microsoft.Dynamics.AX.Xpp.Support.DLL
  • Inside the previous assembly, the X++ run time functions are implemented as static methods of the following class:
Microsoft.Dynamics.AX.Xpp.PredefinedFunctions

Compile Time Functions


Compile time functions are executed early in the compile of X++ code. Most of these functions retrieve metadata about items that are in the Application Object Tree (AOT). Some common compile time functions are as follows:
  • classNum - retrieves the ID of a class.
  • classStr - verifies during compile time that a class by that name exists. This is better than discovering the error later during run time.
  • evalBuf - evaluates the input string of X++ code, and then returns the results as a string.
  • literalStr - retrieves a label ID when given the string representation of a label, such as the string "@SYS12345". For example, myLabel.exists(literalStr("@SYS12345"));.

Note: Compile time functions are sometimes called intrinsic functions.

Note: X++ compile time functions cannot be called from a .NET program.  


My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - X++ Functions' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - Intrinsic Functions

Intrinsic functions are metadata assertion functions. They take arguments that represent entities in the Application Object Tree (AOT), and validate these arguments at compile time. They have no effect at run time. Intrinsic functions are a subgroup of the X++ system functions, and typically have names ending in Num or Str, for example: classNum and formStr.

Intrinsic functions should be used wherever possible in X++ code to make the code resilient to changes to the metadata stored in the AOT.

You will get a best practice warning if you use the for identifierStr function. This is because no existence checking is carried out for identifierStr. Try to use a more specific intrinsic function if one is available.

The following list contains the intrinsic functions in MorphX.

Validation of Table Metadata

  • tableCollectionStr
  • tableFieldGroupStr
  • tablePName
  • tableNum
  • tableMethodStr
  • tableStaticMethodStr
  • tableStr

Validation of Field Metadata

  • fieldNum
  • fieldPname
  • fieldStr
    

Validation of Index Metadata

  • indexNum
  • indexStr

Validation of Data Type Metadata

  • enumCnt
  • enumNum
  • enumStr
  • extendedTypeNum
  • extendedTypeStr
  • typeId
    

Validation of Configuration Key Metadata

  • configurationKeyNum
  • configurationKeyStr

Validation of License Metadata

  • licenseCodeNum
  • licenseCodeStr

Validation of Class Metadata

  • classNum
  • classStr
  • methodStr
  • staticMethodStr

Validation of Form, Report, Query, and Menu Metadata


Where possible, use the AutoDeclaration property on controls.
  • formStr
Note: In forms, control:: controlName returns the ID of the control.
  • formControlStr
  • menuItemActionStr
  • menuItemDisplayStr
  • menuItemOutputStr
  • menuStr
  • reportStr
  • queryStr
  • queryDataSourceStr
    

Validation of Web Metadata

  • webActionItemStr
  • webDisplayContentItemStr
  • webletItemStr
  • webOutputContentItemStr
  • webpageDefStr
  • webReportStr
  • websiteDefStr
  • websiteTempStr
  • webStaticFileStr
  • webUrlItemStr
  • webWebpartStr

Other

  • identifierStr
  • literalStr
  • maxDate
  • maxInt
  • minDate
  • minInt
  • resourceStr
  • varStr

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - Intrinsic Functions' was informative. Please feel free to leave your comments.

Microsoft Dynamics AX 2012 R2 - Functions


 Most of the functions are executed when your application runs, but some are executed earlier by the compiler.

The Global Class contains a set of methods that are generally useful throughout the application. These methods can be considered an extension to the built-in functions in the X++ language. The DateTimeUtil Class also contains methods of general use for manipulating a utcdatetime value.

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - Functions' was informative. Please feel free to leave your comments.