7 Replies Latest reply on Jun 30, 2013 6:27 PM by pfroelicher

    row counter

    pfroelicher

      We need a field in a relationship that "counts" the position.

      On a sales record we have lets say 4 line items.

       

      So in row 1 ie. line item 1, I need the field to return "1", in row 2 the field should display "2".

       

      Any hints.

      Looks simple... probably is..hehe

       

      Help appreciated

      Yours

      Pierre

        • 1. Re: row counter
          debi

          Pierre,

           

          This should work on a portal or in List view, from Layout mode: Insert > Record Number Symbol. In v11 you'll get "@@" and in v12 youl'll get {{RecordNumber}}. You could type them manually as well.

           

          HTH,

           

          Debi Rubel
          FullCityConsulting.

          1 of 1 people found this helpful
          • 2. Re: row counter
            GaryTate

            Another method which you could use if you need to manipulate the rtow number (perhaps for reordering the rows) would be to set up an auto enter calc number field which looks through a relationship on all rows for the sale and adds an incrementing value. This way you can then sort the portal by this value, and use scripts to alter the value to change the row order.

             

            Of course you could have this field there and use the method mentioned by Debi as the display.

             

            Gary

            1 of 1 people found this helpful
            • 3. Re: row counter
              pfroelicher

              Gary, Debi,

              thanks a lot.

              Debi's solution works, but only on a display level. I can put the mergefield "Recordnumber" and it show the portalrow number just fine.

               

              However I need somenthing I can program with. There comes in Gary's solution. However I am technical not savvy enough to make it happen.

              If I make an autoenter calc in the sales_item table with "Get(Recordnumber) it fills just fine WHEN CREATING NEW RECORDS from the sales table.

              However If I try to populate my existing database, based on the saleitems table,  with this, obviousely it numbers them all through, and does not start in each sales record again.

               

              If I try to populate the rownumber field from the sales table (Get(Recordnumber) fills in the number of the sales record.

              So... I have not yet find a simple and foolproof way of numbering related record.

              Thanks yours

              Pierre

              • 4. Re: row counter
                jbante

                Have you tried creating an unstored calculation field using Get ( RecordNumber )?

                • 5. Re: row counter
                  pfroelicher

                  Yes, we did that.

                  It works when you create new lineitems. However existing lineitems it shows their position in the lineitem table or the Recordnumber of the sales record.

                  Thanks

                  Pierre

                  • 6. Re: row counter
                    jbante

                    Are you sure? The behavior you describing above sounds like what a number field with an auto-enter calculation would do, not an unstored calculation. An unstored calculation field in your LineItems table should show the line numbers for each sales orders correctly when you look at the LineItem records in a portal on a layout based on your sales record. (Note that it's important that the calculation is unstored; a stored calculation may not update unless you modify each LineItem record.) Such a field would only show the LineItem position in the entire LineItem table, rather than just on each LineItem's sale, when you're looking at them on a layout based on a LineItem table occurrence. If you're seeing the sales record number in a LineItem portal, I would double-check that you aren't seeing a record number field in the sales table rather than the LineItem table.

                    • 7. Re: row counter
                      pfroelicher

                      Jbante,

                       

                      Thanks. Your where right on.

                      If kept "unstored" the calculation Get(RecordNumber)  in the lineitems table shows the position in the portal.

                      Great...Thanks.

                      Yours

                      Pierre