Forum Discussion

visalinir's avatar
visalinir
Contributor
7 years ago

How to insert a value from a string variable into a row of a Table Variable

Hi, I want to insert a value from a variable of type string into a table variable rows. Please provide the solution.

21 Replies

    • visalinir's avatar
      visalinir
      Contributor

      Hi Alex,

       

      I have attached the code used in my test project, please find the attachment.

       

      In the code, Worksheet refers to my Table Variable Name, WSName refers my Column Name in a table and here TempVar is a variable of type integer which refers to RowCount in a Table.

       

      Is my code correct?

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > Is my code correct?

        Assuming that the variable is named 'Worksheet' and the column is named 'WSName' the code looks to be correct.
        The only thing is the value of TempVar. Rows in the table variables are counted starting from zero. Thus the range of accessible rows is from zero to RowCount-1.

        If you need to add more rows you must first set the value to Rows property (not tested sample):

        Project.Variables.VariableByName("Worksheet").Rows = <new number of rows>

         

        Does your code fail? What is posted to the test log?