× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Peter,

We have such a routine for generating new order numbers and such (we allow letters as well as digits). Input: number to increase (and an optional increment; I'll assume 1). Output: new number.

We use an array with digits and an array with letters (actually, we use compile time tables).

Step 1: Determine actual length of input parameter (in our routine it may be up to 256 characters) by trimming it.
Step 2: Set index to actual length
Step 3: While index > 0 and not overflow:
- Determine if character is digit or letter or neither
- If it is a digit, replace it with the next digit if possible; otherwise replace it with the first digit and set overflow on.
- If it is a letter, replace it with the next letter if possible; otherwise replace it with the first letter and set overflow on.
- If it is neither, set overflow on.
- Decrease index

If you need it, I can send you the actual code.

Joep Beckeringh


Peter Vidal schreef:
Hi list:

I have a field (7/A) that has a combination of letters and numbers. How will the code look so I can go from, ie.:

Original value: MTAA010
Target value: MTZZ990

The first character (M) and the last one (0) will never change. Just positions 2-6

All recommended strategies are welcome,

TIA!


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.