Fork me on GitHub

Other articles


  1. Highlight (select, mark) a record(s) in Grid from X++ [AX2012]

    Solutions

    Highlighting all the records in a grid (including NOT loaded ones)

    Let’s say we have some Control in a Form of type CheckBox, Button or StringEdit and we want it them once modified/clicked to update the form grid by selecting all the records in a grid.

    To ...

    read more

    There are comments. Feel free to leave your comment.

  2. Read XML string (elements, attributes, texts) [AX2012]

    An X++ example of getting the data from a bit more complex XML string.

    Here you can find a tutorial on making XML string in X++.

    Solution (this time only a single Job)

    static void readXMLString(Args _args)
    {
        // Define XML Document and its nodes
        XmlDocument     doc;
        XmlNodeList     xmlScriptList;
        XmlNodeList     xmlProjectList ...
    read more

    There are comments. Feel free to leave your comment.

  3. Building a Query in X++ [AX2012]

    Solution

    An example of Query to find InventSerials, when Works Order is known.

    An example of achieving same result using While/Select statements.

    Class declaration

    public class YourClass
    {
        // Query objects
        Query                   query;
        QueryRun                queryRun;
        QueryBuildDataSource    qbdsInventTransOrigin;
        QueryBuildDataSource    qbdsInventTrans;
        QueryBuildDataSource    qbdsInventDim;
        QueryBuildDataSource    qbdsInventSerial;
        QueryBuildRange         qbr;
    
        // Declare a table buffer
        InventTransOrigin       inventTransOrigin ...
    read more

    There are comments. Feel free to leave your comment.

  4. 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.

  5. 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.

  6. 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.

  7. 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 1 / 1

links

social