Forum Discussion

lucky_star's avatar
lucky_star
Occasional Contributor
6 years ago
Solved

For Loop Operations : How to get the value in array?

Hi all,

 

I have a simple keyword as the attachment use For Loop Operation.

But I don't know how to get the value in array?

The Error Msg is returned :

"Unable to evaluate the operation's "MessageText" parameter. Error: 'i' is undefined

 
Please help to show me, where I was wrong syntax,
Regards,
 
  • The problem is that you need to actually reference "i" as a variable of the test case.  See the info I've highlighted in green.

     

    Change that code to 

     

    KeywordTests.Test1.Variables.arrCode[KeywordTests.Test1.Variables.i]

     

     

5 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    For Loop operation already has a built-in "counter" based on loop variable, which should be an integer (or double) type.

     

    • lucky_star's avatar
      lucky_star
      Occasional Contributor

      Hi ,

       

      May I was misunderstood your guide, please help me review the file keyword attached?  So I can understand build-in of the test tool was supported.

       

      Thanks for your support,

      • baxatob's avatar
        baxatob
        Community Hero

        Hi lucky_star,

         

        Now the start value of your Loop variable is the same that the end value (== 0). So your Loop is do nothing.

         

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The problem is that you need to actually reference "i" as a variable of the test case.  See the info I've highlighted in green.

     

    Change that code to 

     

    KeywordTests.Test1.Variables.arrCode[KeywordTests.Test1.Variables.i]