8 Replies Latest reply: May 19, 2011 4:01 AM by Sravan Puppala RSS

    Peek() in script?

    Sravan Puppala

      Hi

      I have a table like the following

       

      Measreadings.jpg

       

       

      The counterRdgDifference (Counter reading Differences) are coming directly from the database and sometimes those are not calculated as in the case above.

      In such case, I need to calculate the counterRdgDifference in Qlikview.

       

      My assumption is using peek in script. I dont know how to do this in expression.

       

      My idea in script:

       

       

       

      MeasurementTable:
      
      Load *,
      if(DifferenceReading= 0, MeasuringReading-Peek('MeasurementTable',-1) as DifferenceReading
      ;
      
      Load MeasurementDoc,
           Measuringpoint_Key,
           MeasuringUnit_Key,
           Date_Key,
           ReadingDateTime,
           MeasRdg_READG_CHGD * Conversion as MeasuringReading,
           Difference_CDIFF_CHGD * Conversion as DifferenceReading,
           OBJNR_Key,
           MeasPosition_PSORT,
           Description_PTTXT,
           MeterType,
           Description_ATBEZ
      Resident TableX
      ;
      

       

       

      Is it correct or should I do any aggregation in script based on Measuring point and Measuring Doc??

       

      Thanks