Forum Discussion

Lage's avatar
Lage
Contributor
10 years ago
Solved

VBScript to add a new row in a Table variable

Hi all,

 

I'm trying to add a new row into a Table Project.Variable but something is not working for me. I can create new variables from a script but the new row and their values are not stored once the execution finishes. 

 

I can also reproduce my problem just runing this example code obtained here: TableVariable Object  Could anyone run it or tell me what i should do to keep the new row added?

 

Many thanks :þ

 

 

Sub Test1
  Set MyVar = Project.Variables.MyTableVar 
  Set Iterator = MyVar.Iterator
  
  ' Initializes the iterator
  Call Iterator.Reset
  
  ' Iterates through the rows
  While Not Iterator.IsEOF
    ' Returns the column name by its index
    Set ColName = MyVar.ColumnName(1)
    
    ' Retrieves values and posts them to the log    
    value = Iterator.Value(ColName)
    Log.Message(value)  
    
    ' Forwards the iterator to the next row
    Iterator.Next
  WEnd
End Sub

 

 

  • Solved....basic stuff....

     

    The think is that there're two different type of variables, the Temporary and the Persistent. 

     

    The Temporary Variables are reset after the test execution. 

    The Persistent Variables keep the new values.  <-- I should use this type.

     

    more info

     

    Kind regards

    Lage

  • Lage's avatar
    Lage
    Contributor

    Solved....basic stuff....

     

    The think is that there're two different type of variables, the Temporary and the Persistent. 

     

    The Temporary Variables are reset after the test execution. 

    The Persistent Variables keep the new values.  <-- I should use this type.

     

    more info

     

    Kind regards

    Lage