4 Replies Latest reply: Jun 13, 2012 5:57 AM by ehsazhhh RSS

    map (replace) a field of numeric ranges with a field of strings

      I want to write a script to map a field of numeric ranges with a field of strings. for example:

       

      map data:

       

       

      field1                    field2

      1234-1238                 type1

      1239                         type2

      556687-556695          type3

       

       

      sample data:

      123451112233

      556688412563

      1239445544

       

      sample output

      type1

      type3

      type2

       

      above example means that I want to map(replace) any number that start with 1234 or 1235 .... or 1238 to string type1 and so on.

      ranges can be a single number (like type2).

      my map list is big (about 15000 records)

      my data is big too (about 300000 records)

        • Re: map (replace) a field of numeric ranges with a field of strings
          Deepak Kurup

          hi,

           

          Try out the attach application. You will get a small idea.  I have a small query for the above case.

           

          You mention that you need to check starting from 1234 --- 1238 but in the third case the number is  bigger one 556687-556695.

           

          Is there any consitent way of looking into the sample data.

           

          In my application I am not able to retrieve the type for this case.

           

           

          Hope we can discuss and sort out the issue.

           

           

           

            • Re: map (replace) a field of numeric ranges with a field of strings

              thanks for reply.

              each row define new range and type I just explained row 1 to clarify (in my example row 3 means :

              that I want to map(replace) any number that start with 556687 or 556688 .... or 556695 to string type3.)

               

              ranges are numeric with unspecific length.

               

              for example :

              1122335566998877-1122335566998922           type4

               

              so :

               

              112233556699890567895463         is               type4

                • Re: map (replace) a field of numeric ranges with a field of strings
                  Deepak Kurup

                  HI,

                   

                  Clarifying my doubts.

                   

                  In first case you mention to take first  4 character 1234 and match it with the type ? the thrid data has 6 characters to be picked.

                   

                   

                  we need to have a standard logic for the extracting the data from sample data.

                    • Re: map (replace) a field of numeric ranges with a field of strings

                      ok. I said that each row in map is new range of starting numbers, with any length.

                      so it can be XXXXXXabc-XXXXXXxyz

                      the length of X and "abc" is diffrent for each row.

                       

                      if we expand this example :

                       

                      field1                    field2

                      1234-1238                 type1

                      1239                         type2

                      556687-556695          type3

                       

                      we want to map numbers that start with :

                       

                      1234*  totype1

                       

                      1235*   totype1

                       

                      1236*   totype1

                       

                      1237*   totype1

                       

                      1238*   totype1

                       

                      1239*   totype2

                       

                      556687*   totype3

                       

                      556688*   totype3

                       

                      556689*   totype3

                       

                      556690*   totype3

                       

                      556691*   totype3

                       

                      556692*   totype3

                       

                      556693*   totype3

                       

                      556695*   totype3

                       

                      in input data.