Description
The TableVariable.RemoveColumn
method lets you add the specified column from the array represented by the TableVariable
object.
Declaration
TableVariableObj.RemoveColumn(Column)
TableVariableObj | An expression, variable or parameter that specifies a reference to a TableVariable object | |||
Column | [in] | Required | Integer | |
Result | None |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameter:
Column
Specifies the name or index of the column to be removed from the array. The index ranges between 0 and ColumnCount
- 1.
Result Value
None.
Example
The code below demonstrates how you can add columns to and remove them from the array and how you can post the total number of columns and rows in the array to the log.
JavaScript, JScript
function Test1()
{
var MyVar;
MyVar = Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn("LastColumn");
// Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " + MyVar.ColumnCount);
Log.Message("The total number of rows in the array: " + MyVar.RowCount);
// Removes the last column
MyVar.RemoveColumn("LastColumn");
}
{
var MyVar;
MyVar = Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn("LastColumn");
// Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " + MyVar.ColumnCount);
Log.Message("The total number of rows in the array: " + MyVar.RowCount);
// Removes the last column
MyVar.RemoveColumn("LastColumn");
}
Python
def Test1():
MyVar = Project.Variables.MyTableVar
# Adds a new column to the array
MyVar.AddColumn("LastColumn")
# Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " + str(MyVar.ColumnCount))
Log.Message("The total number of rows in the array: " + str(MyVar.RowCount))
# Removes the last column
MyVar.RemoveColumn("LastColumn")
VBScript
Sub Test1
Set MyVar = Project.Variables.MyTableVar
' Adds a new column to the array
Call MyVar.AddColumn("LastColumn")
' Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " & MyVar.ColumnCount)
Log.Message("The total number of rows in the array: " & MyVar.RowCount)
' Removes the last column
Call MyVar.RemoveColumn("LastColumn")
End Sub
Set MyVar = Project.Variables.MyTableVar
' Adds a new column to the array
Call MyVar.AddColumn("LastColumn")
' Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " & MyVar.ColumnCount)
Log.Message("The total number of rows in the array: " & MyVar.RowCount)
' Removes the last column
Call MyVar.RemoveColumn("LastColumn")
End Sub
DelphiScript
procedure Test1;
var MyVar: OleVariant;
begin
MyVar := Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn('LastColumn');
// Posts the total number of rows and columns in the array
Log.Message('The total number of columns in the array: ' + VarToStr(MyVar.ColumnCount));
Log.Message('The total number of rows in the array: ' + VarToStr(MyVar.RowCount));
// Removes the last column
MyVar.RemoveColumn('LastColumn');
end;
var MyVar: OleVariant;
begin
MyVar := Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn('LastColumn');
// Posts the total number of rows and columns in the array
Log.Message('The total number of columns in the array: ' + VarToStr(MyVar.ColumnCount));
Log.Message('The total number of rows in the array: ' + VarToStr(MyVar.RowCount));
// Removes the last column
MyVar.RemoveColumn('LastColumn');
end;
C++Script, C#Script
function Test1()
{
var MyVar;
MyVar = Project["Variables"]["MyTableVar"];
// Adds a new column to the array
MyVar["AddColumn"]("LastColumn");
// Posts the total number of rows and columns in the array
Log["Message"]("The total number of columns in the array: " + MyVar["ColumnCount"]);
Log["Message"]("The total number of rows in the array: " + MyVar["RowCount"]);
// Removes the last column
MyVar["RemoveColumn"]("LastColumn");
}
{
var MyVar;
MyVar = Project["Variables"]["MyTableVar"];
// Adds a new column to the array
MyVar["AddColumn"]("LastColumn");
// Posts the total number of rows and columns in the array
Log["Message"]("The total number of columns in the array: " + MyVar["ColumnCount"]);
Log["Message"]("The total number of rows in the array: " + MyVar["RowCount"]);
// Removes the last column
MyVar["RemoveColumn"]("LastColumn");
}
See Also
Variables of the Table Type
AddColumn Method
ColumnCount Property
ColumnName Property