2 Replies Latest reply: Feb 16, 2012 9:54 AM by silviu andries RSS

    Problems with a variable in macro script.

    silviu andries

      Hello,

       

      I have the following problem:

       

      for P=0 to NoOfRows('Pol1')-1
      LET vPOLICY_ID = chr(39)&Peek('POLICY_ID',$(P),Pol1)&chr(39);

      Pol2:

       

      Load "POLICY_ID" as POLICY_ID2,
      SQL select POLICY_ID, ANNEX_ID, COVER_TYPE, INSR_TYPE
      FROM "INSIS_OMN"."GEN_RISK_COVERED"

      where POLICY_ID=$(vPOLICY_ID);

       

      NEXT P

      ---------------------------------------------------

      The problem is that at the first P=0, my peek function is working and my vPOLICY_ID variable gets the content of Peek('POLICY_ID',$(P),Pol1)

      But after NEXT P statement, P takes the value 1, and my variable vPOLICY_ID becomes NULL. This happens for each P different with 0.

       

      Note that my "Pol1" table has a lot of data inside.

      I have tried not to use P for peek, and to give 0,1,2... instead of $(P) and my peek function works fine...

       

      Can someone detects where is the problem?

       

      Thank you,

      Silviu