will give the result according to the rules in the initial post
Code:
BC123
BC234
CD123
CD234
AB123
AB234
AB456
if there are more first two chars combinations add as many ifthen as needed
even if 1 sequence substitute was needed for the simple case asked
I used a 3 digit sequence number to allow for 26 times 26 combinations
( up to the limit of the IFTHENs for this approach )
the snippet assumes a recolrd length of 80, it should be easy to provide for a different record length
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
This one is simpler aproach...
That may be true for the particular case shown, but the AQ approach is NOT a good general solution for multi-byte keys. If we just change the data a bit, the approach won't work. For example, if the first two characters had to be sorted in the order BC, CB, BB, I don't think the AQ approach could be used, whereas the IFTHEN approach could. In general, AQ is a good approach for changing the order of a single key byte, but not for changing the order of multiple key bytes.