5 Replies Latest reply: Feb 15, 2017 9:54 AM by Evgenii Senko RSS

    No data after resident

    Evgenii Senko

      Hi,

       

      Please look at the script below.

      In this case I will not get any data.

       

      Can't understand logic.

      I use resident and it have to bring all data from Table1 to TableTotal.

       

      Table1:

      Load * INLINE [

      Name, Data

      First, 1

      Second, 2

      Third, 3

      ];

       

      LEFT JOIN(Table1)

      Table2:

      LOAD * INLINE [

      Value

      1];

       

      TableTotal:

      LOAD *

      Resident Table1;

      Drop Table Table1;

        • Re: No data after resident
          Sunny Talwar

          You need to add NoConcatenate necause Table1 and TableTotal have the same field names and will auto-concatenate. To avoid auto-concatenate we add NoConcateante.

           

          Table1:

          Load * INLINE [

          Name, Data

          First, 1

          Second, 2

          Third, 3

          ];

           

          LEFT JOIN(Table1)

          Table2:

          LOAD * INLINE [

          Value

          1];

           

          TableTotal:

          NoConcatenate

          LOAD *

          Resident Table1;

          Drop Table Table1;

            • Re: No data after resident
              Evgenii Senko

              Thanx Sunny.

              You are right.

               

              But one more question plese.

               

              I need also do

              FOR EACH vFile in FileList

              with the same code above.

               

              All files are the same with different data.

              As result I need one table with all data from files.

               

              If I use Noconcatenate I will receive a lot of tables.

              Do you know how to solve it?

                • Re: No data after resident
                  Sunny Talwar

                  Add a flag when you create your new table (for example 1 as Dummy). This will help you avoid the initial auto concatenate. Later you can drop this Dummy field

                   

                  Table1:

                  Load * INLINE [

                  Name, Data

                  First, 1

                  Second, 2

                  Third, 3

                  ];

                   

                  LEFT JOIN(Table1)

                  Table2:

                  LOAD * INLINE [

                  Value

                  1];

                   

                  TableTotal:

                  LOAD *,

                     1 as Dummy

                  Resident Table1;

                  Drop Table Table1;


                  DROP Field Dummy;

                    • Re: No data after resident
                      Evgenii Senko

                      This way create few tables.

                       

                      As I see after first cycle TableTotal will  have different structure to Table1

                       

                      Try to use


                      Table1:

                       

                      Load * INLINE [

                       

                      Name, Data

                       

                      First, 1

                       

                      Second, 2

                       

                      Third, 3

                       

                      ];

                       

                       

                       

                      LEFT JOIN(Table1)

                       

                      Table2:

                       

                      LOAD * INLINE [

                       

                      Value

                       

                      1];

                       

                       

                      Concatenate

                      TableTotal:

                       

                      LOAD *,

                       

                        1 as Dummy

                       

                      Resident Table1;

                       

                      Drop Table Table1;

                       

                       

                      DROP Field Dummy;

                       

                       

                       

                      Get error "Field not found. Did not find field Dummy from the DROP FIELD statement"