7 Replies Latest reply: Feb 29, 2012 7:21 AM by jagan mohan rao appala RSS

    autoincrement with rowno() problem

      hi everybody

       

      is there a way to autoincrement (rowno() function) a column by group like:


      I have:

      storeid | store | rowno()
      ------------------------
      3 | store3 | 1
      3 | store3 |     2
      3 | store3 | 3
      3 | store3 | 4
      7 | store7 | 5
      7 | store7 | 6
      7 | store7 | 7

       

      I need:

       

      storeid | store | rowno()
      ------------------------
      3 | store3 | 1
      3 | store3 |     2
      3 | store3 | 3

      3 | store3 | 4
      7 | store7 | 1
      7 | store7 | 2
      7 | store7 | 3

       

      Thx in advance

        • Re: autoincrement with rowno() problem
          Celambarasan Adhimulam

          Hi,

               There is no predefined function for this i think.Try this approach.

               Table1:

               Load

                    storeid,

                    store

               From DataSource;

               Table2:

               Load Distinct

                    storeid

               Resident Table1;

           

          FOR i=1 to NoOfRows('Table2')

          LET vStoreid=FieldValue('storeid',$(i));

          Let vRows = Alt(NoOfRows('Output'),0);

          Output:

          LOAD

                    storeid,

                    store,

                    RowNo()-$(vRows) as rowno

          Resident

                    Table1 Where storeid=$(vStoreid);

          NEXT i;

           

          Drop Table Table2;

           

          Celambarasan

           

          Edited: Editing problem.Check now. Message was edited by: Celambarasan Adhimulam