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.
luis_gmb
New Contributor

Creating dynamic dates in URLs

Hello friends. I have some questions.


1.- I have a URL where I just want the months and the year to change.


2.- When the month reaches 12, I want them to change to the next year.


Could anyone help me with this topic?


I leave the script:


vMaxMes = 12;

vMinMes = 1;

vMaxAño = 2017

FOR vMes = 1 to $(vMaxMes) - 1

Saidi:

LOAD @1 as [Mes],

  @2 as [Año],

  @3 as [Subdirección],

  @4 as [División],

  @5 as [Zona Distribución],

  @6 as [Usuarios Totales (Promedio) (#)],

  @7 as [DEMUA TIUT Sin Eventos (Minutos)],

  @8 as [DEMUA por Eventos TIUT (Minutos)],

  @9 as [DEMUA TIUT con Eventos (Minutos)],

  @10 as [TIUT Acumulado sin Eventos (Minutos promedio)],

  @11 as [TIUT Acumulado con Eventos (Minutos promedio)],

  @12 as [Meta TIUT (Minutos promedio)],

  @13 as [DEMUA SAIDI Sin Eventos(Minutos)],

  @14 as [DEMUA por Eventos SAIDI (Minutos)],

  @15 as [DEMUA SAIDI con Eventos (Minutos)],

  @16 as [SAIDI Acumulado sin Eventos (Minutos Promedio)],

  @17 as [SAIDI Acumulado con Eventos (Minutos Promedio)],

  @18 as [Meta SAIDI (Minutos Promedio)],

  @19 as [Usuarios Interrumpidos sin Eventos SAIFI (usuarios)],

  @20 as [Usuarios Interrumpidos por Eventos SAIFI (usuarios)],

  @21 as [Usuarios Interrumpidos con Eventos SAIFI (usuarios)],

  @22 as [SAIFI Acumulado sin Eventos (Interrupciones Promedio por Usuario)],

  @23 as [SAIFI Acumulado con Eventos (Interrupciones Promedio por Usuario)],

  @24 as [Meta SAIFI (Interrupciones Promedio por Usuario)],

  @25 as [Clave División],

  @26 as [Clave Zona],

  if(@27='Z','Zona',if(@27='D','División',if(@27='N','Nacional'))) as [Granularidad]

FROM

[http://10.4.13.50:5380/OperacionUtil-war/extractorTablaroIE?ANIO=$(vMaxAño)&MES=$(vMes)]

(txt, utf8, no labels, delimiter is '|', msq);

ENDIF

//STORE Saidi into (qvd);

NEXT

4 Replies

Re: Creating dynamic dates in URLs

Could be possible this case, Would you able to share more in detail please?

Life is so rich, and we need to respect to the life !!!
serj_shu
Valued Contributor

Re: Creating dynamic dates in URLs

Hi, Luis!

Try this:

vMaxMes = 13;

vMinMes = 1;

vMaxAño = 2017

FOR vMes = 1 to $(vMaxMes)

let vMaxAño=if($(vMes)=13,$(vMaxAño)+1,$(vMaxAño))

let vMes=if($(vMes)=13,1,$(vMes)) //there you must to prevent loading dates somehow because it will be loading your dates until crash.

// for instance you can use this condition within the loop before load statement: Exit For When $(vMes)=2 and $(vMaxAño)=2018.

luis_gmb
New Contributor

Re: Creating dynamic dates in URLs

Hello Anil the objective of this process is that by means of two variables year and month you can do an accountant from 1 to 12 that is the 12 months that has a year and when it reaches the last month change the year and start again always and When there is a link on the server.


With this you would automate the extraction of several data with a single link, without having to change the month and year manually.

luis_gmb
New Contributor

Re: Creating dynamic dates in URLs

Hello, Sergey.

Tomorrow I try this solution and tell you that it works.

Thank you.

Community Browser