13 Replies Latest reply: Jul 27, 2018 3:21 PM by Mario Centeno RSS

    Load current month data with do while

    Mario Centeno

      I am using a do while to try to bring data for the current month, but only upload data until the previous month I need your help please.


      /* >> LOADA DATA PER PERIODS ========================================= */

       

       

      LET vPeriodo = (YEAR(TODAY())) & '0'; // CURRENT A YEAR

      LET vMesActual = NUM(MONTH(TODAY())); // CURRENT ACTUAL

      LET vMesProximo = NUM(MONTH(TODAY())+1); // NEXT MONTH

      LET vI = 7; // INITIAL MONTH

       

       

      DO WHILE vI <= vMesActual

       

       

      LET vCiclo = vPeriodo & vI; // BUILD YEAR-MONTH

      TRACE $(vCiclo);

      LET vCiclo = vCiclo & '01'; // BUILD YEAR-MONTH-FIRSTDAY

       

      LOAD

      SELECT * FROM TABLE

      WHERE DATE =  TRUNC(LAST_DAY('$(vCiclo)'))

       

      LET vI = vI + 1;

       

       

      LOOP;