Simple Steps To Create Number Sequence In Ax2012

Creating number seq:

Hello Friends,

Today I want to describe about how to create number sequence in AX2012

It is same as like as we know in Ax2009 but small steps is added in AX2012.don’t worry just follow the below steps simply we will get number sequence in AX2012.

We will Take a EDT name as “Car Id” and create in number sequence .For that first we should select a module for new number sequence for example project module.

Steps:

Step1:   Create an EDT : CarId .

1_0032

Step2:   Write a code on lode module() on NumberSeqModuleProject

3.png

Open load module

4.png

Write a code on lode module

5.pngCode

datatype.parmDatatypeId(extendedTypeNum(CarId));

datatype.parmReferenceHelp(literalStr(“@SYS334483”));

datatype.parmWizardIsManual(NoYes::No);

datatype.parmWizardIsChangeDownAllowed(NoYes::No);

datatype.parmWizardIsChangeUpAllowed(NoYes::No);

datatype.parmWizardHighest(999999);

datatype.parmSortField(20);

datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);

this.create(datatype);

3:Open  Projparameters Table

Drag To Insert In Edt This Table

6.png

Write a method on Projparameters Table

8.png

.

     client server static NumberSequenceReference numRefcarId()

{

return NumberSeqReference::findReference(extendedTypeNum(car Id));

}

 

Step4:Create One New Table

This Format

And Drag To Edt This Table

12.png

Step5.Write a job and run that

9

 

static void Carid(Args _args)

{

NumberSeqModuleProject  NumberSeqModuleProject = new NumberSeqModuleProject();

;

NumberSeqModuleProject.load();

}

       Run The Job

Step6:Then run the wizard

Goto

Organization Administration >> CommonForms >> Numbersequences>>Numbersequences>> Generate >> run the wizard.

 

Step7.Now we have to check the number sequence  is correctly working  for that write a job:

 

static void number(Args _args)

{

NumberSeq  numberSeq;

CarId num;

;

numberSeq = NumberSeq::newGetNum(ProjParameters::numRefcarId());

num = numberSeq.num();

info(num);

}

 

Step8:Create One New Form This Format

10.png

1)Class Declaration

public class FormRun extends ObjectRun

{

NumberSeqFormHandler numberSeqFormHandler;

}

 

2)Write the NumberSeqFormHandler() in form methods node.

NumberSeqFormHandler numberSeqFormHandler()

{

if (!numberSeqFormHandler)

{

numberSeqFormHandler = NumberSeqFormHandler::newForm(ProjParameters::numRefcarId       ().NumberSequenceId,

element,

CarTable_DS,

fieldNum(CarTable, Car Id)

);

}

return numberSeqFormHandler;

}

 

 

3).Write the close() on the form methods node.

 

void close()

{

if (numberSeqFormHandler)

{

numberSeqFormHandler.formMethodClose();

}

super();

}

4)Then final add the below methods on data source methods node

Create()

 

void create(boolean append = false,

boolean extern = false// If created externally

{

element.numberSeqFormHandler().formMethodDataSourceCreatePre();

 

super(append);

 

if (!extern)

{

element.numberSeqFormHandler().formMethodDataSourceCreate(true);

}

}

 

5)Delete()

 

public void delete()

{

element.numberSeqFormHandler().formMethodDataSourceDelete();

super();

}

 

 

6)Write()

 

public void write()

{

super();

element.numberSeqFormHandler().formMethodDataSourceWrite();

}

 

7)Validate Write()

 

public boolean validateWrite()

{

boolean         ret;

ret = super();

ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;

if (ret)

{

CarTable.validateWrite();

}

return ret;

}

 

8)Link Active()

 

public void linkActive()

{

;

element.numberSeqFormHandler().formMethodDataSourceLinkActive();

super();

}

 

 

Output is

11

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s