Task Builder Help Globe Icon

Add Navigation Script: Recognition

Use recognition script to determine whether the current screen is recognized and if the run-time navigation engine should continue with the step's execution.

The script must call the INavSystem.setRecognized method with a true or false value to inform the navigation engine if screen recognition has occurred. If this method is not called in the script, then the navigation engine will automatically consider the step as unrecognized.

Screen recognition typically occurs by comparing the contents of host fields against expected values, although occasionally other types of requirements are necessary to determine recognition, such as examining field attributes.

You can use the IQAScreen interface to examine host fields. The Usage Tips, located on the top pane of the editor, provide the variable names that are available to you and link you to the Javadocs for more information on the objects the variables represent.

The following code snippet illustrates how recognition occurs by verifying that HostField1 contains the string "Sample" and HostField15 contains the string "Example":

	//declare a boolean to be passed to the setRecognized method
	boolean recognized = false;
 	//get the contents of HostField1
	IFieldData hostField1 = qaScreen.getField(0); //field indexes are 0 based
	String strHostField1 = "";
	if (hostField1 != null)
		strHostField1 = hostField1.getText();
	//get the contents of HostField15
	IFieldData hostField15 = qaScreen.getField(14); //field indexes are 0 based
	String strHostField15 = "";
	if (hostField15 != null)
		strHostField15 = hostField1.getText();
	//determine if the recognition criteria has been met
	if (strHostField1.indexOf("Sample") != 0 && strHostField15.indexOf("Example") != -1)
		recognized = true;
	//inform the navigation engine of the results

Disable the Above Script in Step Execution:   Select this option to save your script, but make it unavailable to your task. With this option selected the scripting field is disabled and you cannot edit your script.

Verify Script:   Click this option to verify your script. This will not save changes. If the verification is successful, a message displays in the top pane of the editor. If the verification produces errors, they must be either corrected or the script disabled before you can save the script and proceed with implementing task execution.
Note After you have implemented a scripted recognition rule, the original recognition rule can be viewed by selecting the recognition rule property field, but it cannot be edited. If you disable or delete the recognition script, then the original recognition rule will again be available for editing.
Related Topics
Bullet Adding Scripts to Task Steps
Bullet Using Scripts to Replace Tasks, Overview
Bullet Task Builder for Screens Help Links