2 Replies Latest reply: Apr 10, 2017 2:36 PM by Eduardo DImperio RSS

    Number of rows inside a foreach

    Eduardo DImperio

      Hi everyone,

       

      I need to get the number of rows of date (named DATEINI) to each oid_meter in my table, with this information i'll after use a loop to read every data of every oid_meter. I try the code below, but it only output me the total of date and not total of date for oid_meter.

       

      Test:

      NoConcatenate

      Load Distinct

      OID_METER,

      Floor(DATEINI) AS DATEINI //date field

      Resident Concat_table

      WHERE CONSUMO=0

      ORDER BY DATEINI;

       

       

      FOR Each meter in FieldValueList('OID_METER')

          for vRow = 0 to (NoOfRows('Test')-1)

            

             Let vDataIni = Date(Peek('DATEINI',vRow,'Test'));

             Let vDataFim = Date(Peek('DATEINI',vRow+1,'Test'));

            

             if (Interval(vDataFim-vDataIni,'DD')=1) then

             Count_Int=$(Count_Int)+1;

             endif

             vData[$(vRow)] = $(vDataIni);

             vCount[$(vRow)]= $(Count_Int);

           next

      NEXT meter

       

      There is anyway to replace NoOfRows('Test') for some function that return numer of rows of DATEINI in the current section(current OID_METER) ?

       

      Thanks