4 Replies Latest reply: Jun 10, 2014 6:36 AM by Tresesco B RSS

    calling sub-routine with table creation breaks peek()

    Johan Hessler


      Im developing an application where i first produce a list of field values that a later on send to a sub-routine that uses the field value when creating a table.

      It works as expected if i do not create a table inside my sub-routine but the peek('fieldname',$(i)) I use to get the field value from the first table to send to the sub-routine only works for i = 0 (or the first peek() used.


      Any suggestion that the issue could be?


      I've attached a small qv app that shows the issue, setting the last parameter in the sub-routine call to 'Y' breaks the peek(). Setting it to 'N' everything is working as expected (as no table is created inside the sub-routine).



      sub ffs(inputMonth,createTableYN)

        trace inside sub-routine month is '$(inputMonth)';


        if '$(createTableYN)' = 'Y' then



        '$(inputMonth)' as subMonth

        autogenerate 1;



      end sub;





        month(addmonths(yearstart(today()),recNo())) as month

      autogenerate 12






      // by creating a table in the sub-routine call (last parameter = 'Y') the peek will cease to function properly as only first value is fetched

      for i = 0 to fieldvalueCount('month')-1



        Let vMonth = peek('month',$(i));

        call ffs('$(vMonth)','N');





      App has been tested in 11.2 SR4 and 11.2 SR6 with the same result.


      Br Johan