4 Replies Latest reply: Aug 18, 2017 6:14 AM by Hemeswara Reddy RSS

    Fill In Existing Field

    Afroz Hyder

      Looking for an efficient way to solve this.

       

      Current Data:

      ID, Letter, Test

      01, A, 1

      02, B, N/A

      03, C, 2

      04, D, 3

      05, E, N/A


      New List:

      Letter, Test

      B, 5

      B, 6

      E, 8

      E, 9

       

       

      OUTCOME:

      01, A, 1

      02, B, 5

      02, B, 6

      03, C, 2

      04, D, 3

      05, E, 8

      05, E, 9

       

      Hope this helps.

        • Re: Fill In Existing Field
          kaan erisen

          Try this:

           

          temp_current:

          load * inline [

          ID, Letter, Test

          01, A, 1

          02, B, N/A

          03, C, 2

          04, D, 3

          05, E, N/A

          ];

           

           

          Left Join (temp_current)

          New:

          load * inline [

          Letter, Test2

          B, 5

          B, 6

          E, 8

          E, 9

          ];

           

           

          current:

          Load

          ID,

          Letter,

          If(Test<>'N/A',Test,Test2) as Test

          Resident temp_current;

           

           

          Drop Table temp_current;

          • Re: Fill In Existing Field
            Devarasu R

            Hi,

            Try like this.

             

            TestMap:

            Mapping Load * Inline [

            Letter, Test

                B, 5

                B, 6

                E, 8

                E, 9

            ];

             

            Test:

            load *,ApplyMap('TestMap',Letter,Test) as TestRevised;

            LOAD * INLINE [

                ID,Letter, Test

                01, A, 1

                02, B, N/A

                03, C, 2

                04, D, 3

                05, E, N/A

            ];

             

            Drop Field Test from Test;

            RENAME Field TestRevised to Test;

             

            Thanks,Deva

            • Re: Fill In Existing Field
              mayilvahanan ramasamy

              Hi

               

              Try like this

               

              Current_Data:

              Load * Inline

              [

              ID, Letter, Test

              01, A, 1

              02, B, N/A

              03, C, 2

              04, D, 3

              05, E, N/A

              ];

               

               

              New_List:

              Join

              LOAD Letter, Test as T1 Inline

              [

              Letter, Test

              B, 5

              B, 6

              E, 8

              E, 9

              ];

               

               

              Final:

              LOAD Letter, If(Test = 'N/A', T1, Test) as Test, ID Resident Current_Data;

               

               

              DROP Table Current_Data;

                • Re: Fill In Existing Field
                  Hemeswara Reddy

                  you can try this

                   

                   

                   

                  CurrentData:

                  load * Inline [

                  ID, Letter, Test

                  01, A, 1

                  02, B, N/A

                  03, C, 2

                  04, D, 3

                  05, E, N/A ] Where Test='N/A';

                   

                   

                  left Join

                   

                   

                  Tmp_NewList:

                  LOAD Letter, Test as Test2;

                  LOAD * Inline [

                  Letter, Test

                  B, 5

                  B, 6

                  E, 8

                  E, 9 ];

                   

                   

                  DROP Field Test;

                   

                   

                  RENAME Field Test2 to Test;

                   

                   

                  Concatenate(CurrentData)

                   

                   

                  load * Inline [

                  ID, Letter, Test

                  01, A, 1

                  02, B, N/A

                  03, C, 2

                  04, D, 3

                  05, E, N/A ] Where Test<>'N/A';

                   

                  resgards,

                  hemesh