Description
Use the Data
property to obtain the log item’s dataset by its index in the item’s dataset list. The total number of datasets for the given log item is specified by the DataCount
property.
Declaration
LogItemObj.Data(Index)
Read-Only Property | A LogTableData , TextLogData or PictureLogData object |
LogItemObj | An expression, variable or parameter that specifies a reference to a LogItem object | |||
Index | [in] | Required | Integer |
Applies To
The property is applied to the following object:
Parameters
The property has the following parameter:
Index
The index of the desired dataset. The index is zero-based, that is the first dataset has the index 0, the second - 1, and so on. Index of the last dataset is DataCount
- 1.
Property Value
A LogTableData
, TextLogData
or PictureLogData
object, which contains the desired log item’s data. To determine the data type, use the Scheme.DataType
property of the resulting object.
Remarks
If you use Python or DelphiScript, you should enclose the parameter of the Data
property in square brackets: Data[Index]
.
Example
The code below obtains the total number of child elements that belong to the specified data scheme.
JavaScript, JScript
function LogDataSchemeExample()
{
// Obtains a collection of logs
var LogsCol = Project.Logs;
// Obtains the first log item
var LogItem = LogsCol.LogItem(0);
// Obtains the first dataset
// of the specified log item
var LogData = LogItem.Data(0);
// Obtains the scheme of the dataset
var Sch = LogData.Scheme;
// Obtains the number of child
// datasets that belong to the scheme
var Num = Sch.ChildCount;
Log.Message(Num);
}
Python
def LogDataSchemeExample():
# Obtains a collection of logs
LogsCol = Project.Logs
# Obtains the first log item
LogItem = LogsCol.LogItem[0]
# Obtains the first dataset
# of the specified log item
LogData = LogItem.Data[0]
# Obtains the scheme of the dataset
Sch = LogData.Scheme
# Obtains the number of child
# datasets that belong to the scheme
Num = Sch.ChildCount
Log.Message(Num)
VBScript
Sub LogDataSchemeExample()
' Obtains a collection of logs
Set LogsCol = Project.Logs
' Obtains the first log item
Set LogItem = LogsCol.LogItem(0)
' Obtains the first dataset
' of the specified log item
Set LogData = LogItem.Data(0)
' Obtains the scheme of the dataset
Set Sch = LogData.Scheme
' Obtains the number of child
' datasets that belong to the scheme
Num = Sch.ChildCount
Log.Message(Num)
End Sub
DelphiScript
function LogDataSchemeExample;
var LogsCol, logItem, LogData, Sch, Num;
begin
// Obtains a collection of logs
LogsCol := Project.Logs;
// Obtains the first log item
LogItem := LogsCol.LogItem[0];
// Obtains the first dataset
// of the specified log item
LogData := LogItem.Data[0];
// Obtains the scheme of the dataset
Sch := LogData.Scheme;
// Obtains the number of child
// datasets that belong to the scheme
Num := Sch.ChildCount;
Log.Message(Num);
end;
C++Script, C#Script
function LogDataSchemeExample()
{
// Obtains a collection of logs
var LogsCol = Project["Logs"];
// Obtains the first log item
var LogItem = LogsCol["LogItem"](0);
// Obtains the first dataset
// of the specified log item
var LogData = LogItem["Data"](0);
// Obtains the scheme of the dataset
var Sch = LogData["Scheme"];
// Obtains the number of child
// datasets that belong to the scheme
var Num = Sch["ChildCount"];
Log["Message"](Num);
}
See Also
Access Test Log Contents from Tests
LogItem Object
Child Property
ChildCount Property
DataCount Property