• Post Reply Bookmark Topic Watch Topic
  • New Topic

Max Value  RSS feed

 
Marc LeClerc
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Business Requirement: Automatically Generate the next order number using (0,1,2,3,4,5,6,7,8,9,B,C,F,V,X,Z). In the real world, this will be a 10 character String.

For this example I'll just use a 5 character. The current latest order number = 123V9

The Method should return 123X1 as the next order number.

The only way I could come up with is something like this.


Then go through a bunch if if then else return logic to figure out the next order.

Am I making a mountain out of a molehill here and missing something pretty basic?

Any thoughts appreciated.

Thanks.

Marc
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume there's some additional reasoning behind the way these ordernumbers are structured? For instance, I can imaging that the actual ordernumbers don't consist of a totally random arrangement of alphanummeric characters, but rather that they are made up of data segments?
[ June 11, 2008: Message edited by: Jelle Klap ]
 
Marc LeClerc
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would think so.

Here is a snippet from the spec.

�Work Orders will always be ten characters.
�The first digit will be a one letter prefix that corresponds to the order type (prefixes defined below).
�The next 9 characters will be sequentially generated which ranges from 000000000 to ZZZZZZZZZ utilizing the following 16 characters �0,1,2,3,4,5,6,7,8,9,B,C,F,V,X,Z� (1,048,576 records)

I tried pushing back, but the functional folks are not buding on this one.
It's the way the "Old" system works so it "Has" to be this way.

Sighh.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you write a hack that counts in hex, parse it to a string, then do a substitution of

A => B
B => C
C => F
D => V
E => X
F => Z
???

not pretty or elegant... but it might work.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc LeClerc:
Business Requirement: Automatically Generate the next order number using (0,1,2,3,4,5,6,7,8,9,B,C,F,V,X,Z). In the real world, this will be a 10 character String.

For this example I'll just use a 5 character. The current latest order number = 123V9

The Method should return 123X1 as the next order number.


Wouldn't the next order number be 123VB ?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by fred rosenberger:
could you write a hack that counts in hex, parse it to a string, then do a substitution


Yes, and you could do this in both directions -- i.e., for generating and decoding. I think this is a great solution.
 
Marc LeClerc
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great Idea .. the Hex counting.

Let me play with that a little.

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!