3 Replies Latest reply: Sep 4, 2017 1:11 PM by Gysbert Wassenaar RSS

    Force a value

    Antonio Forino

      Hi guys,

      i have my sales table loaded in the followin way:

       

      - Sales data (TABLE A)

      - concatenation to sales data table (tABLE B)

       

      then there's a LEFT join to antoher table to retrieve value from another table.

       

       

      My goal is to set a value retrieved from a left join, as default only for the data coming from table B

       

      anyone knows how i can achive this?

        • Re: Force a value
          Andrew Walker

          Hi Antonio,

          Why not perform the left join on Table B and then after that has been done concatenate tables A & B?

           

          Cheers

           

          Andrew

          • Re: Force a value
            Antonio Forino

            The left join is needed to retrieve values from table A and B, but just for values coming from table B i would like to keep a default value on just one field. By the way with the left join i also take some others value that needs not to be defaulted.

              • Re: Force a value
                Gysbert Wassenaar

                Perhaps like this:

                 

                tempData:

                LOAD *, 'A' as SourceTable FROM TableA;

                 

                CONCATENATE (tempData)

                 

                LOAD *, 'B' as SourceTable FROM TableB;


                LEFT JOIN (tempData)


                LOAD * FROM TableC;


                Data:

                NOCONCATENATE

                LOAD *, If(SourceTable='A', FieldX, 'Default') as FieldY RESIDENT tempData;


                DROP TABLE tempData;

                DROP FIELDS FieldX, SourceTable;

                RENAME FIELD FieldY TO FieldX;