2 Replies Latest reply on Jan 4, 2014 5:37 AM by Oliver_Reid

    Question about GetNthRecord

    bartprins

      Hi there and happy new year to all,

       

      I've got two tables one for instance is Customers and the second table is Products where they have a relationship one customer to many products. (The fields and names are just an example)

       

      I have made a layout with Customerdetails and Products in a portal.

      In the table Products there is a field [productname] and a field [VAR] which has a value of "000000000002" for each record (i get these from a third party) which i want to edit with a plus one for each product for that customer

       

      So for instance:

       

      Customer1

      Apples000000000002

      Bananas000000000003

      Customer2

      Pears000000000002

      Bananas000000000003

      Apples000000000004

       

      etc..etc..

       

      I think i have to use a loop with GetNthRecord, where i say something like: GetNthrecord edit [serial + 1] or something in that order but know where to start

       

      Thanks for reading

       

      Bart Prins

        • 1. Re: Question about GetNthRecord
          wimdecorte

          Hi Bart,

           

          What layout do you want to be on to do the looping?  Customers?  As in you want to loop through all the customers?

           

          GetNthRecord can only read data, I'm sure you are aware of that.  If you are on a customer, do you want to loop through all of its products.. and do what exactly?  Increase the value of Var to Var + 1 for each product records?

           

          If you are going to loop through all products to upate each product record then there is no point in using GetNthRecord.

          The benefit of GetNthRecord is that you can loop through records without physically moving to the record.  But you can't modify the records that way.

          • 2. Re: Question about GetNthRecord
            Oliver_Reid

            It looks like you are trying to add a line item number for each fruit in a customer order (Starting at 2 for some reason that is not clear)

             

            If that is the case I would simply script a "GTRR and replace" step to number the line items for that order each time an order is edited. Or, loop through the Portal incrementing the VAR field using Go to Portal Row.