10 Replies Latest reply: Jul 14, 2011 4:36 PM by Ralf Becher RSS

    Strange behaviour with for loop and peek?

    Chris Brain

      This is confusing me! I have a table which I can correctly peek at values in using the following:

       

      let y = peek('page', 0, FacebookProConnector_Page);    // y = "value1'

      let y = peek('page', 1, FacebookProConnector_Page);    // y = "value2'   

      let y = peek('page', 2, FacebookProConnector_Page);    // y = "value3'   

       

      However, in a for loop, e.g.:

       

      let noRows = NoOfRows('Table1');

       

      for i=0 to $(noRows) // loop through every row

       

           let y = peek('page', $(i), Table1);

       

           // Additional load statement to other table here

       

      next

       

      I get weird behaviour.

      - in the first iteration (i=0), y is correctly 'value1'

      - In the second iteration (i=1), y = NULL ?????

       

      But this only happens if I have the additional load statement (where the comment is above) present. If I remove the inner load to another table (and just have an empty loop) it seems to work ok.

       

      I can't see what I could be doing wrong - would appreciate any ideas.

       

      This is happening QlikView 9 desktop.