Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
juan_patrick
Contributor

Change Table name Dynamic

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!!






1 Reply

Re: Change Table name Dynamic

Try adding in NoConcatenate after the table name variable like this:

[$(vNombreTabla)]:

NoConcatenate

  LOAD

  '$(vClave)' AS %KEY_FECHA,

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

  Autogenerate '$(vMeses)' + 1;

HTH

Best,

Sunny

Community Browser