Thursday, November 26, 2020

How to create Number sequence Based on selected year in ax 2012 using X++


Hi guys, Today we see how to create a number sequence based on the selected year in ax 2012 using X++.


Here I am using 2 EDT's. Dax Year, New Year. I create a number sequence for that 2 EDT's.

In the setup level I mentioned 2020 for one EDT and for the other I mentioned 2021.


 public void numSeq()

{

    NumberSeq                numberSeq1,numberSeq2;

    TestingMain                testingLoc;


    //str                                    parmNum;

    super();

    testingLoc= element.args().record();

    //select firstOnly testingLocwhere testingLoc.Action==NoYes::Yes;


    if(testingLoc.DaxYear=='2021' && testingLoc.Action==NoYes::Yes)

    {

        numberSeq1 = NumberSeq::newGetNum(NumberSeqReference::findReference(extendedTypeNum(DaxYear)));

        DAXTesting.DaxYear=numberSeq1.num();

        DAXTesting.insert();

    }

    else if(testingLoc.DaxYear=='2020'&& testingLoc.Action==NoYes::Yes)

        {

            numberSeq2 = NumberSeq::newGetNum(NumberSeqReference::findReference(extendedTypeNum(NewYear)));

            testingLoc.NewYear=numberSeq2.num();

            testingLoc.insert();

        }

}

keep Daxing!!

No comments:

Post a Comment