1 Reply Latest reply: Jun 4, 2015 10:54 AM by Sunny Talwar RSS

    Change Table name Dynamic

    Juan Patricio Iorio

      Hi, I have this script:

       

      FOR vReg = 0 TO NOOFROWS('INTERVALOS')-1

        LET vMeses = PEEK('DIF', $(vReg),'INTERVALOS');

        LET vFMIN = PEEK('FEMIN', $(vReg),'INTERVALOS');

        LET vClave = PEEK('KEY', $(vReg),'INTERVALOS');

        LET vNombreTabla = 'INTERVALOS_FULL_' & PEEK('ANIO', $(vReg),'INTERVALOS');

       

        [$(vNombreTabla)]:

        LOAD

        '$(vClave)' AS %KEY_FECHA,

        date(AddMonths('$(vFMIN)',recno()-1),'YYYYMM') AS AÑOMES

        Autogenerate '$(vMeses)' + 1;

       

      Next vReg;

       

      where vNombreTabla is the table's name, but, I want to create some tables with the year, something like this:


      INTERVALOS_FULL_2014

      INTERVALOS_FULL_2015


      The table name is INTERVALOS_FULL_ + YEAR


      The problem is the script only create one table! (INTERVALOS_FULL_2001) and I know there are more years in the field.



      Thanks!!