Load an ActiveData asset for use by a script.
Workbench.LoadActiveData("activeDataName", [sheetName, startRow, endRow, randomCount, readOnly])
Variable | Description |
---|---|
activeDataName | The name of the
ActiveData asset that you want the script to use.
STRING.
Note: If your environment uses multiple projects, use a project qualifier to insert an
ActiveData asset, which is not uniquely named, from the Common project. For details, see the example.
|
sheetName | Optional: The name of the sheet that is used. The sheet specified here overrides the sheet that is specified in the ActiveData asset. By default, the sheet that is specified in the asset is used. STRING |
startRow | Optional: The index of the row in the ActiveData asset to load first. INTEGER. |
endRow | Optional: The index of the row in the ActiveData asset to load last. INTEGER. |
randomCount | Optional: Determines if and how records from the ActiveData file associated with the asset are used in the ActiveData test. A value of 0 or False turns off random mode. The value of -1 or True uses all rows from the StartRow value through EndRow value in a random order in the ActiveData test. A value of 1 through N, where N is the number of rows in the Test Data asset, uses that number of random rows from the range from StartRow to EndRow. For additional information about using different StartRow and EndRow values with the acceptable values for the RandomCount parameter, see Determining Data Use for ActiveData. INTEGER. |
readOnly | Optional: Determines whether to open the ActiveData asset as read/write or read only. Set to False to open the ActiveData asset with read/write permission. Set to True to open the ActiveData asset as read-only. If set to read-only, any operation that attempts to write to the ActiveData asset in the ActiveData testing portion of a script generates a run-time error. ActiveData asset are opened for read/write permission by default. BOOLEAN. |
Public Sub Main() AddRandomToPhoneBook( 3 ) 'Reads 3 rows in a random order End Sub Public Sub AddRandomToPhoneBook( howMany As Integer ) Dim data As ActiveData = Workbench.LoadActiveData( "PhoneBookData", 1, -1, howMany ) Dim row As ActiveDataRow With _desktop.BrowserWindow("/BrowserApplication//BrowserWindow") For Each row In data Dim FirstName As String = row.GetString("fname") Dim LastName As String = row.GetString("lname") Dim PhoneNumber As String = row.GetString("number") .DomTextField("@id='txtFirstName'").SetText(FirstName) .DomTextField("@id='txtLastName'").SetText(LastName) .DomTextField("@id='txtPhoneNumber'").SetText(PhoneNumber) .DomButton("@id='btnAdd'").Select() Next End With End Sub
Public Sub Main() AddSomeToPhoneBook( 3, 5 ) 'Reads rows 3, 4 and 5 only End Sub Public Sub AddSomeToPhoneBook( firstToAdd As Integer, lastToAdd As Integer ) Dim data As ActiveData = Workbench.LoadActiveData( "PhoneBookData", firstToAdd, lastToAdd ) Dim row As ActiveDataRow With _desktop.BrowserWindow("/BrowserApplication//BrowserWindow") For Each row In data Dim FirstName As String = row.GetString("fname") Dim LastName As String = row.GetString("lname") Dim PhoneNumber As String = row.GetString("number") .DomTextField("@id='txtFirstName'").SetText(FirstName) .DomTextField("@id='txtLastName'").SetText(LastName) .DomTextField("@id='txtPhoneNumber'").SetText(PhoneNumber) .DomButton("@id='btnAdd'").Select() Next End With End Sub
Public Sub Main() AddAllToPhoneBookReadOnly() 'Opens the data file as read only End Sub Public Sub AddAllToPhoneBookReadOnly() Dim data As ActiveData = Workbench.LoadActiveData( "PhoneBookData", 1, -1, 0, True ) Dim row As ActiveDataRow With _desktop.BrowserWindow("/BrowserApplication//BrowserWindow") For Each row In data Dim FirstName As String = row.GetString("fname") Dim LastName As String = row.GetString("lname") Dim PhoneNumber As String = row.GetString("number") .DomTextField("@id='txtFirstName'").SetText(FirstName) .DomTextField("@id='txtLastName'").SetText(LastName) .DomTextField("@id='txtPhoneNumber'").SetText(PhoneNumber) .DomButton("@id='btnAdd'").Select() Next End With End Sub
Public Sub Main() AddAllToPhoneBookReadOnly() 'Opens the data file as read only End Sub Public Sub AddAllToPhoneBookReadOnly() Dim data As ActiveData = Workbench.LoadActiveData( "Common.PhoneBookData", 1, -1, 0, True ) Dim row As ActiveDataRow With _desktop.BrowserWindow("/BrowserApplication//BrowserWindow") For Each row In data Dim FirstName As String = row.GetString("fname") Dim LastName As String = row.GetString("lname") Dim PhoneNumber As String = row.GetString("number") .DomTextField("@id='txtFirstName'").SetText(FirstName) .DomTextField("@id='txtLastName'").SetText(LastName) .DomTextField("@id='txtPhoneNumber'").SetText(PhoneNumber) .DomButton("@id='btnAdd'").Select() Next End With End Sub