4 Replies Latest reply: Dec 20, 2012 5:12 AM by Aidan Marriott RSS

    Peek/order by problem

      Hi

       

      I am struggling to udnerstand why the peek function is not working correctly for me.

       

      I am using the following code to ascertain if two consecutive rows have a flag, and if so populate a row:

       

      Load *,
      if(EmailFlag = '1', if(peek(PlanFlag) = EmailFlag and peek(OpCode) = OpCode and peek(account) = account,'Email Sent','Email Not Sent'),'') as EmailSentFlag

      Resident DebttransMO

      Order by account,OpCode, date,time desc;

       

      The strange thing is that for some records it works fine - however for others it does not. As you can see from the below, there are 3 occasions where both flags are populated but only one shows Email Sent in the EmailSentFlag column despite the same conditions being met.

       

      SShot.png

      Can anyone help exaplin this?

       

      Thanks!