Fork me on GitHub
  1. Using While Select and Ranges in X++ [AX2012]

    Solution

    An example of While/Select statements to find InventSerials, when Works Order is known. Here I also will use a chance to note the ListEnumerator. No Joins are used in this example.

    An example of achieving same result using Queries.

    Class declaration

    public class YourClass
    {
        InventTransOrigin               inventTransOrigin;
        InventTrans                     inventTrans ...
    read more

    There are comments. Feel free to leave your comment.

  2. AX/SQL Best Practices

    Check current SQL Server values:

    EXEC sp_configure;
    

    1) Trace flags 4136 ,1117 and 4199 enabled on SQL server.

    DBCC TRACEON(4136,-1) 
    DBCC TRACEON(1117,-1) /* If you've configured multiple data files and you want to allow auto grow, consider enabling trace flag 1117, which will force all data ...
    read more

    There are comments. Feel free to leave your comment.

  3. TCP/IP Client (derived from C# to X++) [AX2012]

    Solution

    TCP/IP Client based on an example in my C# code. This example demonstrates how to send a string to TCP/IP Server and receive response back from it. The response is being read in batches.

    The solution can be easily converted to Inbound Service.

    Service data contract attribute ...

    read more

    There are comments. Feel free to leave your comment.

  4. Generate XML string [AX2012]

    Apologies if the logic in produced XML file doesn’t make much sense. I use it merely as an example of some complex XML attributes and nesting.

    The method below returns XML string, which later can be saved as XML file or consumed as a XML string by web services ...

    read more

    There are comments. Feel free to leave your comment.

  5. Checking if a Specific Record Exists in a Table [AX2012]

    As a Method

    Class declaration

    class YourClass
    {
        InventSerial inventSerial;
    }
    

    Method

    public static boolean existsSerial(str 20 _serial)
    {
        return _serial
            && (select firstOnly RecId from inventSerial
                /* index hint GroupIdx //index hint is IGNORED in AX 2012. */
                where inventSerial.InventSerialId == _serial).RecId != 0;
    }
    

    As a Service

    Service data contract attribute

    [DataContractAttribute]
    class YourServiceDataContract ...
    read more

    There are comments. Feel free to leave your comment.

« Page 2 / 2

links

social