How to call a local variable in custom keyword


i have a search text field and data table. once the keyword enters and hit ENTER from keyword the results will be displayed in the data table. so sending the data from excel sheet to enter into the textbox that is storing in a variable as ExpectedValue and wrote for loop that contains the related text from the display results. once it matches and trying to highlight the text . here is the code

WebUI.setText(findTestObject(‘searchtextfield’), findTestData(‘exceltestsuite’).getValue(1, 1))

WebUI.sendKeys(findTestObject(‘searchtextfield’), Keys.chord(Keys.ENTER))

String ExpectedValue = findTestData(‘exceltestsuite’).getValue(1, 1)

println(‘11111111------------>’ + ExpectedValue)

WebDriver driver = DriverFactory.getWebDriver()


WebElement Table = driver.findElement(By.xpath(’//table[@id=‘datatable’]/tbody’))

List links = Table.findElements(By.xpath(’//tr/td’))

for (int j = 0; j < links.size(); j++) {
//println("total link: " + links.size())
‘Verifying the expected text in the each cell’
if (links.get(j).getText().contains(ExpectedValue)) {

    println('------------>' + ExpectedValue)
    String searchedword = links.get(j).getText();
	println(">>>>>>>>>>>>>" + searchedword)
} else {
    CustomKeywords.''(findTestObject('Reg6130(1)(a)/td_No Records found'))


please help me how to call the searchedword variable in the keyword.logs are below:

org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: is applicable for argument types: (java.lang.String) values: [I1900291]
Possible solutions: run(com.kms.katalon.core.testobject.TestObject), any(), dump(), grep(), find(), print(

It expects TestObject - as you do in else statement.

correct…but i dont have an object to call since it is a dynamic table and the is storing in searchedword. so my question is how to call the above variable in this class instead of object