create next number sequences in dynamics ax by code

hello all,

i have a form in dynamics ax that i want to generate new InventSerialId that it is a kind of number sequences.

how i can get next number sequences by code , like this :

Serial-0000001 , Serial-0000002 , Serial-0000003 , ?

thanks

HI jm ,

select the numseq field from the table , do the orderby as numberSeq field is a string type.

remove the “Serial-” using string finction. Convert it into integer using str2int function.

Eg :from Serial-0000001,Serial-0000001,Serial-0000001 we will get Serial-0000003 , convert it in to integer 0000003 .Here u wil get the 1 only .Here we need to calculate how many “0” we need to append at the left side in later steps.

Increasse the number which we hav got in last step by one.convert it into string using int2str function.

Append the zero as well as the number sequence format to the left side .

insert it into numseq field.

Look into documentation for the number sequence framework, you’ll find some examples there.

Hi,

This topic was already discussed many many times here. Please search for them.