Search code examples
katalon-studio

Query with defined value after variable ${}


i have script to retrieve data stored in text file, then use variable query ${} to parse the data.

example:

data kept in text file is abc

below statement will execute query productId = 'abc'

Now, I want to append defined value after the abc. to make the query like below:

productId = 'abc/NDC-1111'

what should be the exact syntax i need to use?

//Read productId
def productId = new File(RunConfiguration.getProjectDir() + "/Data Files/productId.txt")
//SQL statement
dbQuery2 = /SELECT * FROM db.t1 where productId = '${productId.text}'/

Solution

  • You can just do:

    dbQuery2 = "SELECT * FROM db.t1 where productId = ${"$productId.text/NDC-1111"}"