Forum Discussion

liquidphantom's avatar
liquidphantom
Occasional Contributor
7 years ago

Unable to remove a column from a Table variable

Absolutly stumped on this one.   I have a ProjectSuite table variable that is 0x0 size when the suite starts. In the first test case to use the table I add each required column, 6 in total, then ad...
  • tristaanogre's avatar
    7 years ago

    When you remove a column, the column count reduces.... so, when you remove column index 0, now the max number of columns is down to 5.... when you remove 1, it's now 4, when you remove column 2, it's now 3... so, when you remove column 3... well, there are only columns 0, 1, and 2 any more... so column 3 is out of bounds.  What I would do, actually, is completely remove the variable and recreate it rather than add/remove columns.  There is a ProjectSuite.Variables.RemoveVariable method that will remove the variable... wrap it in logic to check "If variable exists, remove it" and then ProjectSuite.Variables.AddVariable to add it back in.  

     

    The alternative option is to run your for loop as a "down to"... stepping down from max to 0.