Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2012-08-22T22:43:30Z by SystemAdmin
SystemAdmin
SystemAdmin
7754 Posts
ACCEPTED ANSWER

Pinned topic Remove Numbers using Rule Set

‏2012-08-11T22:30:00Z |
Hi All,

I need to create a rule set to remove the numbers at the end from the below pattern.
3259C83

Basically I want to separate 3259C and 83.

I have used investigate stage to identify the pattern and pattern is complex mix.(qsInvPattern:@).

Please let me to create a rule set to handle this pattern.

Regards,
NP
Updated on 2012-08-22T22:43:30Z at 2012-08-22T22:43:30Z by SystemAdmin
  • RobertDickson
    RobertDickson
    33 Posts
    ACCEPTED ANSWER

    Re: Remove Numbers using Rule Set

    ‏2012-08-12T15:19:03Z  in response to SystemAdmin
    Hi NP,

    There are multiple possible ways. Can you provide a bit more information?
    -Is the 'separator' character ALWYAS a C?
    -Is it ALWAYS a number-C-number? (i.e. a @ pattern)
    -Is the trailing number ALWAYS 2 positions?
    -Is this the ONLY data for this rule, or are there other words in the data? (i.e. Is the data something like 'This is a bronze version of part number 3259C83; currently out of stock.')

    The reason for the questions is that there are potential solutions in both Pattern Action Language in the Standardize stage, and the Transformer stage.


    Regards,
    Robert
    • SystemAdmin
      SystemAdmin
      7754 Posts
      ACCEPTED ANSWER

      Re: Remove Numbers using Rule Set

      ‏2012-08-18T22:37:43Z  in response to RobertDickson
      Hi Robert,

      Thanks for the quick response. Below is the summary of my issue.

      Currently I have created the rule set to handle below patterns.

      111
      TRUST3
      NNN111
      RE FOR MBA117
      ABN A DD DFD 2
      O'BRIEN MBA 8213
      BENEFIT A CN 087 648 815
      C ASSC 17 428 543 685
      O'BRIEN MBA 8213 2009 125 33 44

      Where there is a number concatenated at the end of the word, strip the number to a separate field and use this number field, along with the string field in matching.

      Ex:
      Original word field value: HAWKE VIC 4505 2009
      New String field value: HAWKE VIC
      New Number field value: 45052009

      Same way I need to handle the 3259C83 pattern, basically I need to separate as below.

      Original word field value: 3259C83
      New String field value: C
      New Number field value: 325983

      Pattern is always (4 Numbers – Character - 2 Numbers)

      Please find the attached rule set herewith.

      Regards,
      NP

      Attachments

      • RobertDickson
        RobertDickson
        33 Posts
        ACCEPTED ANSWER

        Re: Remove Numbers using Rule Set

        ‏2012-08-19T16:16:11Z  in response to SystemAdmin
        Hi Koditun,

        For the 4 Number - 1 Char - 2 Number:
        Use the PICT option. For example:

        *@ ;Complex with four numeric, 1 char, 2 numeric
        COPY [1](1:4) {leadingNumeric}
        COPY [1](5:5) {middleChar}
        COPY [1](6:7} {trailingNumeric}
        RETYPE [1] 0

        For some of the numeric ones, you can try something more generic (if you can assume that the data, once numerics start, will continue with numeric until the end of the line):

        *^ | ** | A ; From the first numeric to the ZQWORDTWOZQ separator
        COPY [1] temp
        CONCAT [2] temp ;this will remove the spaces from [2], so '123 456 789' will become '123456789'
        COPY temp {NEWNUM}
        RETYPE [1] 0
        RETYPE [2] 0

        The above will handle an unlimited number of numerics after the first, so you do not have to code to be very specific as to the number of numerics (3, 4, 5, 6, etc).

        I hope this helps!

        Robert
        • SystemAdmin
          SystemAdmin
          7754 Posts
          ACCEPTED ANSWER

          Re: Remove Numbers using Rule Set

          ‏2012-08-22T22:43:30Z  in response to RobertDickson
          Hi Robert,

          It worked and thanks for your all comments, really appreciate it.

          Regards,
          NP