
Figure 0.24 Write Script to Generate Data
This dialog is accessed from the Edit Insert Data Scenario dialog. It is used to write your own VBScript to be used for generating test data. Here you really have the power at your fingertips to customize TurboData to generate data in almost any format you want!
For example, you could write script to return the square root of a number:
Function fnResult()
fnResult = SQR(64)
End Function
This will return 8.
You can refer to other columns in the scenario, and use the generated data from those columns. You must use the correct format though or TurboData will not know that it is not part of your script.
For example, to return the square root of a column called total_quantity on a table called Order:
Function fnResult()
fnResult = SQR(<{TD}Order(1).total_quantity)>)
End Function
Helpful hint: There is a lot of information and examples regarding VBScript on the internet. Please visit msdn.microsoft.com/scripting for complete documentation.
Warning: Do not forget to test thoroughly. TurboData will not validate your syntax in the script Builder. Do not change the function name or the End Function statement.