Forum Discussion

6578's avatar
New Contributor
2 years ago

"Unknown Variable Container" Message

Hello, everyone!


Using the Generate Data option, I created a table (12x2000) but I receive an exception (A row index must be an integer value) every time I attempt to use any of it. In doing some reading through the board, I saw someone else had difficulty which was resolved when adjusting the variable values and removing the trailing quotations and comma:


ProjectSuite.Variables.ComplaintData("ConsumerPhoneNumber", "")


When I do this and click "Finish", I get the ""Unknown Variable Container" message. Anyone have any thoughts on this?

6 Replies

  • Kitt's avatar
    Regular Contributor

    You get this message after you click Finish from the Data Generator Wizard?

    Or when you attempt to use the table variable in your scripts? I would start by checking to see how your project variable was saved (is the Type = Table or DB Table? is there data in the table?):


    and if you wanted to extract random data from this generated table you could do so by referencing this [TestComplete guide] -  Here is an example of how you might return a random phone number from your table:



    function test() {
      var value;
      var randoRowNum = getRandomInteger(1, 2000);
      var randoPhoneNum = ProjectSuite.Variables.Var1.Item(9, randoRowNum);
      Log.Message("random row = " + randoRowNum + " | random phone number = " + randoPhoneNum);
    function getRandomInteger(min, max) {
      var intMin = min;
      var intMax = max;
      if (equal(intMin, null) && equal(intMin, null)) {
        intMin = 1;
        intMax = 10;
      return Math.round(Math.random()*(intMax-intMin)+intMin);



    and here is the log returning the value from a random row in column 9 (phone#):


    Since you are using Keyword tests, I would also give this a look [TestComplete reference]

    • 6578's avatar
      New Contributor

      Thanks, Kitt !


      After reading your response and looking into it some more I was able to get the generated data entered into the keyword tests. Now that the data is going in, however, the test will just start over. I currently have it set to go from the beginning of the sheet to the end, which I suspect is the cause here. If I specify the start / end record to a given number, won't it keep reusing the same data or am I misunderstanding?

      • Kitt's avatar
        Regular Contributor

        6578 Each time you run the test() function in my example, it should retrieve a different phone number to use during that test run. I am accomplishing this by using a custom function called getRandomInteger() to return a random number between x and y. In my example I'm passing the size of your table to getRandomInteger(1, 2000), since you have 2000 records. 

        line 2: var randoRowNum = getRandomInteger(1, 2000);
        line 3: var randoPhoneNum = ProjectSuite.Variables.Var1.Item(9, randoRowNum);

        Line 2 would set the randoRowNum variable as the random number that is returned at runtime. 

        Line 3 would use that random rowX number to find a value in column 9, rowX (AKA your phone numbers) and set it as a variable that you can reference in your tests as randoPhoneNum, which should remain the phone number used throughout the test.


        If you re-ran the test() function 5 times, it should find a different phone number each time. Not sure if this answers your question, but I may have misunderstood your inquiry.