3 Replies Latest reply: Jan 31, 2012 10:44 AM by Jason Michaelides RSS

    Find & Replace

    Umesh Gajjar

      Dear Sir,

       

      We are having following type of records in our database under department fields. Now we want to replace this file with CSG and MKTG wherever text is appear as CSG and Marketing.

       

      Ahmedabad  -CSG
      Baroda -CSG
      CSG -BVN
      CSG -Kutch
      Marketing -Baroda
      Marketing -Rajkot
      Surat -Marketing

       

      Regards,

      UMESH

        • Find & Replace
          Vijay Kumar

          Hi If I understand correctly you want to replace Baroda-CSG with CSG and Marketing-Baroda with Marketing.

           

          You can use substringcount function.

           

          If(Substringcount(Field,'CSG')=1,'CSG',

          If(SubstringCount(Field,'Marketing')=1,'Marketing',Field)) as aa

           

          Hope this will help

          • Re: Find & Replace
            Perumal Ayyappan

            Hi,

            Please Find Attachement .Check this correct or not.

            • Find & Replace
              Jason Michaelides

              Not exactly sure of your requirements so choose one of these in your load script:

               

              LOAD

                        Replace(Department,'Marketing','MKTG')          AS          Department

              FROM

              [C:\Documents and Settings\Umesh.Gajjar\Desktop\department.xlsx]

              (ooxml, embedded labels, table is Sheet1);

               

              OR

               

              LOAD

                IF(Department='CSG and Marketing','CSG and MKTG',Department) AS Department

              FROM

              [C:\Documents and Settings\Umesh.Gajjar\Desktop\department.xlsx]

              (ooxml, embedded labels, table is Sheet1);

               

               

               

               

              Hope this helps,

               

              Jason