3 Replies Latest reply: Nov 2, 2016 2:01 PM by christian thies RSS

    Basic for...next loop in script, but can't make it to work

    christian thies

      Hi everyone. I'm Christian, a Qlik newbie, and this is my first question

      I have several days in a qvd file, have no problems to obtain maximun and minimun dates, and number of days between that dates

       

      What I want to do is a loop that goes from 0 to that number of days. But I'm making something wrong. The loop always exits because of the 'if' condition rather than 'for' condition.

       

      What I'm doing worng? Thanks in advance

       

      cotas:

      LOAD

      min(Date(Floor(FechaAlta))) as minimo,

      max(Date(Floor(FechaAlta))) as maximo,

      max(Date(Floor(FechaAlta)))-min(Date(Floor(FechaAlta))) as dias

      Resident carga;

       

      LET vDiasInFile = 'dias';

      LET vPasesInFile = 0;

       

      for vI = 0 to '$(vDiasInFile)'

      vPasesInFile = vPasesInFile + 1;

       

      IF vI >= 10 then

      EXIT For;

      ENDIF

       

      NEXT vI