Declaring fields

Top  Previous  Next

As previously mentioned, HostSurfer automatically creates a collection of fields from the screen that satisfies the 'match' criterion, assigning them a default name based on their row and column locations.

However, there can be situations when the developer wants a field to be explicitly named, or the field data to be transformed or compound in same particular way.

To do so, named fields must be declared as the value of the 'fields' property, within the 'apply' property of the HostSurfer rule.

Given the selected screen:




the three entry fields, corresponding to USERNAME, PASSWORD and NEW PASSWORD will be explicitly declared and created.


The following code snippet shows how they are set in the rule:


           fields : [

               { name : 'username', row : 19, col : 67, len : 6},

               { name : 'password', row : 20, col : 67, len : 6},

               { name : 'newPassword', row : 21, col : 67, len : 6}


Please note that, even when only the three entry fields were explicitly declared, the 'data' property of the HostSurfer instance holds all screen fields in the field collection, including those we declared, but with default names.