3 Replies Latest reply on Apr 18, 2016 11:24 AM by sharpie

    Order - orderline etc

    sharpie

      I have something like an orderline table

       

      It has a composite foreign key if that makes a difference.

       

      I want to know the best way (if any) to make like a serial number for each orderline on order x e.g. 1,2,3,4 BUT I want the numbering to stay just within each order.  And starts at 1 for a new again for a new order record?

       

      Please.

       

      Thanks

      sharpie

        • 1. Re: Order - orderline etc
          jormond

          What is your use-case for serializing tthe orderline? Is there a use outside of display on the order or invoice?

           

          If it is just a display item for an invoice ir order recap, just insert a merge field for RecordNumber.

          • 2. Re: Order - orderline etc
            CarstenLevin

            I agree with Joshua, what are the order specific counter numbers going to be used for.

            Are they going to be used for setting sort order?

             

            One way of doing it:

            • Go to related order lines from order*.
            • replace field content script step.
            • replace with serial numbers, start from 1.

             

            *First check that there are at least one order line.

             

            But what is the purpose?

             

            Best regards

             

            Carsten

            • 3. Re: Order - orderline etc
              sharpie

              Hello

               

              I'm not sure I just got given the requirement of how that field should work.  I did it In the end by making a self join with 2x TOs of the same table and then counting the number of related lines within one record, if none then the result is 1.  If there's more than one count the related and + 1. 

               

              Thanks for the answers.