2 Replies Latest reply: Oct 1, 2012 8:55 AM by Roberto Postma RSS

    Get the next field value


      I want to create a new column in my script where I use a value i the next row. My table is sorted the way I want it, so that's not an issue. I have created another column where I use a value on the previous row by using the Previous function. Is there a function in QlikView that allows me to compare a field value in the current row with a field value in the next row so that I can create my new column?


      Best regards, L. Sletten

        • Re: Get the next field value
          Miguel Angel Baeyens de Arce



          You can use the Column() function, where Column(1) refers to the first expression column, Column(2) to the second, and so.


          Hope that helps.



          • Re: Get the next field value
            Roberto Postma

            Hi Lindasletten,


            Actually you're looking for the next() function, right? Which functions exactly as the previous function, but instead returns the value of the next record... Correct?


            If so, then the answer is that the next() function does not exist, but there is a way to work around it: sort your data descending (perhaps in a resident table) and use the previous function. This gives the same result.




            When you load field 1 and 2 from the  the table above sorted desc on field 1, the 'next-fieldValue' column can be calculated using the previous(field2) expression.