After you associate a datasheet with a script, you can edit the script to use data from the datasheet. When a script runs, it uses the values from the first datasheet row and repeats the script until all rows are used.
Note: The following steps apply to Keyword View and Text View.
1. Select the step that contains the data you want to replace with a datasheet value.
2. Choose Script > Edit Statement.
The Edit Statement dialog box opens.
3. Select Datasheet and select the datasheet column to use from the corresponding list.
Tip: To view the script and datasheet at the same time, right-click the script or datasheet tab in the Script pane and select New Horizontal Tab Group or New Vertical Tab Group.
4. Click OK.
The datasheet reference is added to the script step.
Note: You can use datasheet statements to navigate datasheets and perform tasks. For example, you can read and write values in database fields or delete database records.
In this example, a script with an associated datasheet enters data in a web page form. The Cell statement retrieves data from the associated datasheet cell and assigns values to variables. The data is entered in the corresponding form fields. The script continues to enter data based on the current datasheet row until all rows are used.
firstName = Cell("first name")
lastName = Cell("last name")
email = Cell("email address")
company = Cell("company")
phone = Cell("phone number")
Window("WysiCorp Feedback Acknowledgment").Editbox("editboxFirst").TypeText(firstName)
Window("WysiCorp Feedback Acknowledgment").Editbox("editboxLast").TypeText(lastName)
Window("WysiCorp Feedback Acknowledgment").Editbox("editboxEmail").TypeText(email)
Window("WysiCorp Feedback Acknowledgment").Editbox("editboxCompany").TypeText(company)
Window("WysiCorp Feedback Acknowledgment").Editbox("editboxPhone").TypeText(phone)
In this example, a script with an associated datasheet enters data in a web form and sets a cell value in a datasheet row. The Cell statement retrieves data from the associated datasheet cell and assigns a new value for the emailAddress variable. The data is entered in the corresponding form fields. The SetCell statement is also used to write the variable value to a datasheet cell.
emailAddress = Cell("B") + "@wysicorp.com"
Window("WysiCorp Report a Bug").Editbox("First Name").TypeText(Cell("A"))
Window("WysiCorp Report a Bug").Editbox("Last Name").TypeText(Cell("B"))
SetCell("C", emailAddress)
Window("WysiCorp Report a Bug").Editbox("Email Address").TypeText(Cell("C"))
Window("WysiCorp Report a Bug").Editbox("Company Field").TypeText(Cell("D"))
Window("WysiCorp Report a Bug").Editbox("Phone Number").TypeText(Cell("E"))
Window("WysiCorp Report a Bug").Button("Send to WysiCorp").Click()