erniew
13 years agoNew Contributor
Temporary table variables
Temporary table variables are not being stored in Table. This SmartBear example will create a table (1 row and 1 column) if one does not already exist, but no data is written to the table cells.
function TableVarTest()
{
// Create a table variable if it doesn't exist
if(!Project.Variables.VariableExists("MyTable"))
Project.Variables.AddVariable("MyTable", "Table");
// Get a reference to the variable
var t = Project.Variables.VariableByName("MyTable");
// Add columns to the table
t.AddColumn("Name");
t.AddColumn("Age");
t.AddColumn("City");
// Create two rows
t.RowCount = 2;
// Fill in the table
// The first row
t.Name(0) = "John Smith";
t.Age(0) = 24;
t.City(0) = "Seattle";
// The second row (using the Item property)
t.Item("Name", 1) = "Bob Feather";
t.Item("Age", 1) = 59;
t.Item("City", 1) = "Milltown";
}
I have not been successful in exectuting any script that is able to edit a table variable.
This on version 9.10.1894. Any suggestions are appreciated.
function TableVarTest()
{
// Create a table variable if it doesn't exist
if(!Project.Variables.VariableExists("MyTable"))
Project.Variables.AddVariable("MyTable", "Table");
// Get a reference to the variable
var t = Project.Variables.VariableByName("MyTable");
// Add columns to the table
t.AddColumn("Name");
t.AddColumn("Age");
t.AddColumn("City");
// Create two rows
t.RowCount = 2;
// Fill in the table
// The first row
t.Name(0) = "John Smith";
t.Age(0) = 24;
t.City(0) = "Seattle";
// The second row (using the Item property)
t.Item("Name", 1) = "Bob Feather";
t.Item("Age", 1) = 59;
t.Item("City", 1) = "Milltown";
}
I have not been successful in exectuting any script that is able to edit a table variable.
This on version 9.10.1894. Any suggestions are appreciated.