2 Replies Latest reply: Dec 26, 2016 8:26 AM by Ernesto José Virgili RSS

    Increase value of a field, "n" times

    Ernesto José Virgili

      When loading a numeric field (IdSolic) from a qvd, use Repeated to count the repeats and set up a frequency table. The problem is that monthly, from 1 to "n" IdSolic records have zero value and are grouped as such (for example: 124 replicates), generating an error in the count. That is, I would need to count them as unique cases, for which the sequence must be transformed incrementally: if there are five registers with zero (0,0,0,0,0), they should remain as 0,1,2,3,4. So for the number of zeros to be added each month.

      I will appreciate help in resolving this.

        • Re: Increase value of a field, "n" times
          Gysbert Wassenaar

          Perhaps something like this: AutoNumber(RecNo(), IdSolic) as Repeated

            • Re: Increase value of a field, "n" times
              Ernesto José Virgili

              Hi, Gysbert. I tried to modify the script as you told me but I must have done it wrong because the load does not finish being completed. I am using a qvd with more than one million records and the field of interest IdSolicitud, where it is like this:

               

               

              Turnos01:
              NoConcatenate
              LOAD
                  IdSolicitud,
              FROM [lib://IM_QS_GT/Turnos.qvd](qvd);
              COUNTS:
              LOAD
                 IdSolicitud,
                  COUNT(IdSolicitud) AS Repeated
              Resident Turnos01 Group By IdSolicitud;
              Turnos:
              NoConcatenate
              Load
                
                  IdSolicitud,
                 
              Resident Turnos01 Order By IdSolicitud;
              Drop Table Turnos01;

               

               

              Records have numeric values that can be repeated. Example: 22,23,23,24,0,25,25,25,26,0,27,28,28,0,0, ...

              As is the script in the table there are 4 cases of 1 repetition (22,24,26 and 27), 2 cases of 2 repetitions (23 and 28), 1 case of 3 repetitions (25) and 1 case of 4 repetitions (zero).

              I need the values zero to count as a unit different from each, so do not group and count as cases of a repetition, ie, the 4 zeros must be: 0,1,2,3 in such a way that the table Remain as: 0,1,2,3,22,23,23,24,25,25,25,26,27,28,28, ... and count 8 cases of 1 repetition.