Random numbering

Henry
Henry Member Posts: 18
edited 2002-12-18 in Navision Financials
Hello guys (and girls),

I hope one of you can help me out with the following problem:

For our batch numbering i've created a new no. serie where i make use of the default numbering (automatically). This because the batch no. has to be unique.

Example:
A001, A002, A003......

The problem is that i would like to use a random numbering where each number must be unique.

Example:
A001, A871, A342....

Is this possible in Navision? Thank you for thoughts!

Greetzz,
Henry

Comments

  • AK
    AK Member Posts: 226
    Without coding this is not possible. But you can extend codeunit 396 to behave like you want. I would store every created number in a separate table and compare my new random number with this table.
    But this would put a growing load on the server, depending on how much numbers will be created...
  • Luc_VanDyck
    Luc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Maybe you can use Year Month Day Hour Minutes Seconds to form your Batch No.?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Henry
    Henry Member Posts: 18
    Thanks Luc & AK for your replies.

    With the function RANDOM(IZE) i can create raondom numbers but to be unique i have to check all batch no.'s (like AK mentioned). This will lead to bad performance (like AK mentioned). Does anybody knows what other solution to use?

    Unfortunately i can't use YEARMONTHDATE because the batch no. has to be printed on the article and we have a limit on the characters we can use.

    Thanks,
    Henry
  • AK
    AK Member Posts: 226
    Another solution could be to create a formula which calculates a unique number out of some given parameters, for example date, time and costumer no.
    Could be as simple as formatting date (e.g. 18/12/02), time (10:32:17) and costumer no (4711) into one number (1812021032174711) and converting it into a hex value (6700605F2C477). This is of course not a random number, but it looks like one. And it's too long for your purpose, but may be it is a starting point.
    Actually I have no idea about how to prove if the number is really unique (when using another formula than the one above)... Any mathematic whizkids around?