3 Replies Latest reply: May 21, 2018 2:30 PM by Глеб Аитов RSS

    Create a table made of two (for each)

    Глеб Аитов

      Hi,

       

      I am struggling with the following: i need to combine two tables into ResultTable as below.

       

      MainTable:

      Date
      2018-01-01
      2018-01-02

       

      CompanyTable:

      CompanyAccount
      Abank1
      Abank2
      Bbank2
      Bbank3

       

      ResultTable:

      DateCompanyAccount
      2018-01-01Abank1
      2018-01-01Abank2
      2018-01-01Bbank2
      2018-01-01Bbank3
      2018-01-02Abank1
      2018-01-02Abank2
      2018-01-02Bbank2
      2018-01-02Bbank3

       

       

      //I loaded all dates from my Calendar as a start:

      MainTable:


      LOAD

      Date

      RESIDENT [Calendar];


      //Then for each Date I want to load Company-Account values from the CompanyTable

      FOR EACH a in FieldValueList('Date')


      Concatenate ([MainTable])

      LOAD

      Company,

      Account

      RESIDENT [CompanyTable];

         

      NEXT a;



      It does not work as I want - it just created the following table:

       

      DateCompanyAccount
      Abank1
      Abank2
      Bbank2
      Bbank3
      2018-01-02
      2018-01-02
      2018-01-02
      2018-01-02

       

      I guess it is wrong to use Concatenate here, than what is the correct way?

       

      Thank you!