Interview Questions

What is Datapool Commands

Rational Robot FAQ


(Continued from previous question...)

What is Datapool Commands

In order to use the datapool functionality you must add the sqautil.sbh header file to all your scripts that will utilize the datapool.
SQADatapoolFetch - is used to retrieve an entire row (record) of values from the datapool. Call SQADatapoolFetch(dp)
SQADatapoolValue - is used to retrieve an individual value from the fetched datapool row and assign it to a script value.
Call SQADatapoolValue(dp, 4, ccNum)
dp = datapool name
4 = the column in datapool
ccNum = the column name in the datapool
SQADatapoolOpen - is used to open a specific datapool.
dp=SQADatapoolOpen("name of datapool")
SQADatapoolClose - is used to close a specific datapool.
Call SQADatapoolClose(dp)

Example of a GUI Script that used datapools:
‘$Include "sqautil.sbh"

Sub Main
	Dim Results as Integer
	Dim x as Integer	
	‘reference the datapool
	Dim dp as Long	
	‘variable to be assigned data from the datapool
Dim ccNum as String
	
	‘Open the datapool
	dp=SQADatapoolOpen("name of datapool")

	‘now this code will populate a full record from the datapool 10 times.
	For x = 0 to 9
	Call SQADatapoolFetch(dp)
	‘Begin
	Window SetContext, "Caption=Main Window; Class=Window", ""
	PushButton Click, "Text=Order"
	Window SetContext, "Caption=Order Window; Class=Window’, ""

	‘add the value to the order window
	Window SetContext, "Caption=Order Window; Class=Window’, ""
	EditBox Click, "ObjectIndex=3", "Coords=13,14"
	Call SQADatapoolValue(dp, 4, ccNum)
	InputKeys ccNum

	Window SetContext, "Caption=Order Window; Class=Window’, ""
	PushButton Click, "Text=OK"

Next x
	Call SQADatapoolClose(dp)
End Sub

(Continued on next question...)

Other Interview Questions