Re: A new twist on the last problem (D3/NT)



On 29 Aug 2006 02:00:14 -0700, "johnmarshall@xxxxxxxxxx"
<johnmarshall@xxxxxxxxxx> wrote:

Folks
my posting a few weeks back revolved around getting the front numeric
characters of a stream of record IDs like the following:

R123
R12345
RC12
RC123
RC12345
S12
SV123456
SVX679101
SVX123

and the solution kindly proposed by a helpful poster was a synonym like
the one below called TYPE

001 S
002 0
003 TYPE
004
005
006
007
008 MCA
009 L
010 6

This synonym gave me all the alphas in the record ID so for the above
data I got 1 to 3 alpha characters, which was great as it allowed me to
seperate the data for reporting purposes, as the leading alphas
indicated the type of job (Production, repair, R&D, marketing etc etc)

All was going well until today, when horrors, I noticed that some users
had also been raising job numbers in the form R123A RC1234C SZY45T
etc, so that my TYPE synonym stopped working the way I wanted as it
now returned results like RA, RCC, SZYT for the data whereas I just
wanted just the first alpha part before the numeric, ie R, RC, SZY.

Is their any simple tweak that I can do to my synonym to get just those
pesky leading alpha characters? Note that the number of leading alphas
and the following numerics can vary, but the end alpha (after the
numeric) if present at all, is only ever 1 character.

Oh, yeah? Mate, if you believe that, then I've got a bridge in
Sydney that's surplus to requirements, and you can have it for.....

Being the probable that gave you the original answer, I must declare
that THIS is about the time I'd leap out into a subroutine and cover
the bases now, and leave the way open to cover any other unforeseen
contingencies....

Being Vanilla Pick, look at CALL....

And in the CALLed subroutine, I'd just start with a heap of CASE
statements:

X = ''
BEGIN CASE
CASE THIS.ID MATCHES "1A0A1N0N"; X = THIS.ID.
CASE THIS.ID MATCHES "1A0A1N0N1A"; X = THIS.ID[1,LEN(THIS.ID)-1]
....
....
END CASE
RETURN

and have the MCA conversion in attr 7 of the DICT item as a proper
"conversion". Over time, as users discover more tricks to thwart
your best endeavours, you can just add to the subroutine with more
CASE statements....

I appreciate that this is more than a gentle tweak to a DICT item, but
sooner or later you're going to have to do it..... May as well do it
now, and save the bandwidth for every other possibility that *IS*
going to crop up....

HTH

Regards,

Bruce Nichol
Talon Computer Services
ALBURY NSW Australia

http://www.taloncs.com.au

If it ain't broke, fix it until it is....
.



Relevant Pages

  • A new twist on the last problem (D3/NT)
    ... This synonym gave me all the alphas in the record ID so for the above ... data I got 1 to 3 alpha characters, which was great as it allowed me to ... wanted just the first alpha part before the numeric, ie R, RC, SZY. ... and the following numerics can vary, but the end alpha (after the ...
    (comp.databases.pick)
  • Re: A new twist on the last problem (D3/NT)
    ... This synonym gave me all the alphas in the record ID so for the above ... data I got 1 to 3 alpha characters, which was great as it allowed me ... leading alphas and the following numerics can vary, ...
    (comp.databases.pick)
  • Re: A new twist on the last problem (D3/NT)
    ... This synonym gave me all the alphas in the record ID so for the above ... data I got 1 to 3 alpha characters, which was great as it allowed me ... leading alphas and the following numerics can vary, ...
    (comp.databases.pick)
  • Re: A new twist on the last problem (D3/NT)
    ... The practical way seeing these items already exist - write a basic subroutine to parse the ID and return only the leading alpha characters. ... This synonym gave me all the alphas in the record ID so for the above ... and the following numerics can vary, but the end alpha (after the ...
    (comp.databases.pick)
  • Re: How can I trap this Vlookup error in a VBA macro
    ... It's always 5 characters, with an initial alpha and four numerics if ... Richard Buttrey ...
    (microsoft.public.excel.programming)