3 Replies Latest reply: Oct 5, 2016 5:36 PM by Marco Wedel RSS

    Transpose based on data - Script

    Matthew Davies

      Hello all,

       

      I was wondering if you could assist me in a potential transposing query.

       

      I have a table as below:

      ProductSales

      Shoes

      3
      Jackets2
      Shorts1

       

      the aim is to transpose and repeat the data within the table to show the product multiple times (as below). This will require the data to be read and an rows created on a variable that will change frequently.:

       

      Product
      Shoes
      Shoes
      Shoes
      Jackets
      Jackets
      Shorts

       

      I was hoping to achieve this with a scenario similar to:

       

      for i = 1 to ... but so far i have been able to get the desired results.

       

      The rational for doing this is to later concatenate another field of information i receive outside of my control.

       

      Does anyone have any suggestions on how this can be done?

       

      Thanks in advance...