what command do you use to move from one row to another in a datatable? uft
Likewise, Microsoft Excel testers tin read input data dynamically at runtime from UFT DataTable to parametrize input fields. Datatable in UFT makes it very easier for testers to create information-driven test cases that can be used to run an Action multiple times. Past default, each action in UFT has its own Datatable simply information technology can exist accessed from any activity within a exam. Datatable is loaded with amazing functionalities and it's up to y'all how you leverage its benefits in your automation test scripts. There are two types of DataTable in UFT.
- Local DataTable − Each action has its ain local DataTable, which can likewise exist accessed across actions. Whenever an action is created UFT adds a local sheet for the specific action. To know more than about action delight refer to my mail service on actions Everything near Deportment in UFT.
- Global DataTable − Each examination has ane global data canvass that is attainable beyond deportment.
What You lot Will Acquire?
- one Operations On UFT DataTable
- 1.ane DataTable Object
- 1.i.1 DataTable Object Methods
- 1.i.1.one Few Examples of Datable Object Methods
- 1.i.2 DataTable Object Backdrop
- 1.i.2.ane Few Examples of Datable Object Backdrop
- 1.1.2.2 Value: How to read information from DataTable in UFT
- i.one.2.3 Value: How to set a value into the UFT DataTable Sheet at runtime
- 1.1.2.4 RawValue: How to read raw value from DataTable in UFT
- 1.i.1 DataTable Object Methods
- ane.ii DTParameter Object
- 1.2.1 DTParameter Object Properties
- 1.ii.1.1 Few Examples of DTParameter Backdrop
- 1.2.1.ii Name: How to become Column name of UFT DataTable
- 1.2.1 DTParameter Object Properties
- ane.3 DTSheet Object
- one.three.1 DTSheet Object Methods
- i.3.1.1 Few examples of DTSheet Object Methods
- i.three.1.2 AddParameter: How to add a new Column in UFT DataTable at runtime
- one.3.ane.3 GetParameterCount: How to count Cavalcade numbers in UFT DataTable
- ane.3.two DTSheet Object Properties
- 1.three.2.i Instance: How to get active sheet name from UFT DataTable at runtime
- one.three.1 DTSheet Object Methods
- 1.ane DataTable Object
- 2 Recommended Posts
The DataTable is accessible from the Data Tab of the lower pane in UFT.
The automation examination script is executed equally many times as many records are there in the datatable for that particular action. It means if in that location are 10 records in the datatable of an activeness of a Test, that action will be executed 10 times. Usually, we do non want this to happen. It is can exist controlled past changing UFT Run Settings. Become to File -> Settings -> Run (Tab) every bit shown below and gear up run from row data row and to data row to 1.
You tin can write repeated steps within a loop in the test script and iterate the datatable in UFT to read all rows.
Operations On UFT DataTable
UFT provides iii types of objects to access and perform various kinds of operations on a UFT Datatable.
| Sr.No | Object Blazon And Clarification |
|---|---|
| 1 | Data Table Object. Provides methods to perform operations on run-time data table object only. |
| 2 | DTParameter Object Methods. Provides methods to perform operations on parameter (cavalcade) in a canvas in the run-fourth dimension data tabular array. |
| 3 | DTSheet Object Methods. Provides methods to perform operations on a sheet in the run-time data table. |
DataTable Object
DataTable Object Methods
The post-obit methods are associated with Datatable Object.
| Method Proper name | Description | Syntax |
|---|---|---|
| AddSheet | Adds the specified sheet to the run-time data table | DataTable.AddSheet(SheetName) |
| DeleteSheet | Deletes the specified sail from the run-time data table | DataTable.DeleteSheet SheetID |
| Consign | Exports the Datatable to a new file in the specified location | DataTable.Consign(FileName) |
| ExportSheet | Exports a Specific Sail of the Datatable in run-time | DataTable.ExportSheet(FileName,SheetName) |
| GetCurrentRow | Returns the active row of the run-time data table of global canvas | DataTable.GetCurrentRow |
| GetRowCount | Returns the number of rows in the run-time data table of Global Sheet | DataTable.GetRowCount |
| GetSheet | Returns the specified sail from the run-time data table. | DataTable.GetSheet(SheetID) |
| GetSheetCount | Returns the full number of sheets in the run-fourth dimension data table. | DataTable.GetSheetCount |
| Import | Imports a specific external Excel file to the run-time data table. | DataTable.Import(FileName) |
| ImportSheet | Imports the specified sheet of the specific excel file to the destination sheet. | DataTable.ImportSheet(FileName, SheetSource, SheetDest) |
| SetCurrentRow | Sets the Focus of the Current row to the Specified Row Number | DataTable.SetCurrentRow (RowNumber) |
| SetNextRow | Sets the focus of the next row in the run-time data table | DataTable.SetNextRow |
| SetPreviousRow | Sets the focus of the previous row in the run-time information Table | DataTable.SetPrevRow |
Few Examples of Datable Object Methods
Consider the post-obit Tabular array for Datatable for the below examples.
AddSheet: The method is used to add a canvas at runtime. In one case the execution gets over runtime added sheets won't be available for any use.
| DataTable . AddSheet "Sheet1" |
Output:
Sheet1 will be added to the UFT Datatable. Y'all can apply the DeleteSheet method to delete information technology at runtime.
GetSheet: It returns the specified sheet from the run-time information table.
| DataTable . GetSheet ( "Sheet1" ) . GetRowCount 'Returns the Sheet1 from the run-time data table. |
GetRowCount: It returns the full number of rows in the longest cavalcade of a canvass in the data tabular array. The following example uses the GetRowCount method to observe the full number of rows in the longest cavalcade(the column having maximum records) of the MySheet run-time datasheet and displays it on the message box.
| numOfRows=DataTable . GetSheet ( "MySheet" ) . GetRowCount Msgbox numOfRows 'Message box will displays 3 |
GetSheetCount: Information technology returns the full number of sheets in the run-time data table.
| sheetcount = DataTable . GetSheetCount Msgbox sheetcount 'Bulletin box will displays 3 as there are 3 sheets in the DataTable |
SetCurrentRow: It southward ets the specified row as the electric current (active) row in the run-time information table. The first row is numbered 1. The post-obit example set the current row value to ii and retrieve the value from Surroundings cavalcade for the 2d row and displays its value in the message box.
| DataTable . GetSheet ( "Global" ) DataTable . SetCurrentRow ( 2 ) 'Setting current row to two strEnv = DataTable . Value ( "Environment" , "Global" ) Msgbox strEnv 'Message box displays UAT |
DataTable Object Properties
The following properties are associated with Datatable Object.
| Holding Name | Clarification | Syntax |
|---|---|---|
| GlobalSheet | Returns the first sheet of the run-time data table. | DataTable.GlobalSheet |
| LocalSheet | Returns the Active local sail of the run-time information table. | DataTable.LocalSheet |
| RawValue | Retrieves the raw value of the jail cell | DataTable.RawValue ParameterID, [SheetID] |
| Value | Retrieves the value of the cell in the specified parameter. | DataTable.Value(ParameterID, [SheetID]) |
Few Examples of Datable Object Properties
Consider the following DataTable.
Value : How to read information from DataTable in UFT
The following example returns the Global Sail, sets the row value to two, and gets the value of the Amount cavalcade.
| DataTable . GetSheet ( "Global" ) DataTable . SetCurrentRow ( 2 ) 'Setting current row to ii valAmt = DataTable . Value ( "Amount" , "Global" ) Msgbox valAmt 'Message box displays 150 |
Value : How to set a value into the UFT DataTable Sheet at runtime
The following example returns the Global Sheet, sets the row value to two, and sets the value "D5340" in the ItemNo column.
| DataTable . GetSheet ( "Global" ) DataTableSetCurrentRow ( two ) 'Setting current row to 2 DataTable . Value ( "ItemNO" , "Global" )= "D5340" |
RawValue : How to read raw value from DataTable in UFT
The following example retrieves the raw value of the cell in row number 2 in the Corporeality column.
| DataTable . GetSheet ( "Global" ) DataTable . SetCurrentRow ( 2 ) 'Setting current row to two valAmt = DataTable . RawValue ( "Amount" , "Global" ) Msgbox valAmt 'Message box displays C3*D3 that is formula written in the cell |
DTParameter Object
DTParameter Object Backdrop
| Property Name | Description | Syntax |
|---|---|---|
| Name | Returns the proper noun of the parameter in the run-time datatable. | DTParameter.Proper name |
| RawValue | Returns the raw value of the cell in the electric current row of the runtime datatable. | DTParameter.RawValue |
| Value | Retrieves or sets the value of the jail cell in the electric current (active) row of the parameter in the run-fourth dimension datatable. | DTParameter.Value |
| ValueByRow | Retrieves the value of the jail cell in the specified row of the parameter in the run-time datatable. | DTParameter.ValueByRow (RowNum) |
Few Examples of DTParameter Backdrop
Name: How to go Column name of UFT DataTable
The following example volition add a parameter in the local sheet and return the value that has been given to the parameter.
| strParamname = DataTable . LocalSheet . AddParameter ( "Food" , "Burger" ) . Proper noun Msgbox strParamname ' Mesage box displays Food |
ValueByRow: How to recall the value of the cell in the specified row using the parameter name
| Msgbox DataTable . GetSheet ( "Global" ) . GetParameter ( "ItemNo" ) . ValueByRow ( 2 ) 'Message box displays B220 |
DTSheet Object
DTSheet Object Methods
| Method Name | Description | Syntax |
|---|---|---|
| AddParameter | Adds the specified parameter (column) to the sheet in the run-time data table and sets the value of the first row to the specified value | DTSheet.AddParameter(ParameterName,Value) |
| DeleteParameter | Deletes the specified parameter from the sheet in the run-time data table. | DTSheet.DeleteParameter(ParameterID) |
| GetCurrentRow | Returns the row number of the current (agile) row in the run-time Information pane sheet. | DTSheet.GetCurrentRow |
| SetCurrentRow | Sets the specified row every bit the current (active) row in the run-time data table. | DTSheet.SetCurrentRow(RowNumber) |
| GetRowCount | Returns the full number of rows in the run-time DataTable | DTSheet.GetRowCount |
| GetParameter | Retrieves the specified parameter from the run-time Data pane canvas. | DTSheet.GetParameter(ParameterID) |
| SetNextRow | Sets the row after the current (active) row equally the new current row in the run-time Information pane canvass. | DTSheet.SetNextRow |
| SetPrevRow | Sets the row above the electric current (active) row equally the new electric current (active) row in the run-time Data pane sheet. | DTSheet.SetPrevRow |
| GetParameterCount | Returns the total number of Columns in the run-time DataTable. | DTSheet.GetParameterCount |
Few examples of DTSheet Object Methods
AddParameter: How to add a new Column in UFT DataTable at runtime
The following case volition add a new sheet MySheet and add a new parameter to it
| DataTable . AddSheet ( "MySheet" ) ParamName=DataTable . GetSheet ( "MySheet" ) . AddParameter ( "COLUMN1" , "VALUE1" ) |
GetParameterCount: How to count Column numbers in UFT DataTable
The following example will count the number of columns in a UFT DataTable Canvass.
| parameterCount=DataTable . GetSheet ( "Global" ) . GetParameterCount MsgBox parameterCount 'Bulletin box displays five, Refer above DataTable Snapshot |
DTSheet Object Backdrop
| Belongings Name | Description | Syntax |
|---|---|---|
| Proper name | Returns the name of the run-time data sheet. | DTSheet.Proper noun |
Example: How to become active canvass name from UFT DataTable at runtime
The following example uses the Proper noun method to render the proper name of the active run-time datasheet.
| Sheetname = DataTable . LocalSheet . Name MsgBox Sheetname 'Message box displays active sheet name |
- What are new features in the new UFT One Datatable
- 20 Useful VBA Date Functions in UFT Yous Must Know
- Import Excel File into Datatable in UFT
- Capture Screenshots in UFT and Save them in Word Doctor
- Automation Object Model in UFT One (AOM)
- Component Object Model in UFT | DOM | TOM & BOM
- File Organization Object (FSO) UFT | VBA
- Read, Write and Update Excel File In UFT
- Reading and Updating MS Admission Database Using ADODB in UFT
- Read and Update XML File in UFT | VBA
- VBScript Loops: Do Loop, For Loop, For Each, and While Loop
- VBScript MySQL Database Connection in UFT
lombardotheirried.blogspot.com
Source: https://myskillpoint.com/datatable-in-uft-one-example-of-datatable-methods/
0 Response to "what command do you use to move from one row to another in a datatable? uft"
Post a Comment