IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
The following article will demonstrate how to use type casting to convert an INTEGER data type to a STRING for use with the SetText() method.
The SetText() method only accepts a STRING data type to be used for the text value in its parameters. If you need to use an INTEGER type, you can use type casting to convert to a STRING and then pass this into the SetText.
The below code shows how this can be done by converting an integer to a string in the Integer2String function and then calling this in the Convert() testcase.
[-] String Integer2String (integer y) [ ] [ ] STRING text [ ] text = ([STRING]y) [ ] print (text) [ ] [ ] TextField.SetText(text) [ ] [ ] return text [ ] [-] testcase Convert() appstate none [ ] Integer2String(12345)
For further reading on type casting and the available operators, please see the Silk Test help topic 'Type Cast Operator'.