• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Max Value

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great Idea .. the Hex counting.

Let me play with that a little.

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic