Forum Discussion

mpw83's avatar
mpw83
Contributor
12 years ago

[Res] groovy - change to lower case

Hi All,

I have following groovy script in one of our SOAPUI script,


import groovy.sql.Sql

def prescription_order_administration_id = context.expand('${#TestSuite#MedAdminIdAlreadyAdministered}' )

sql = Sql.newInstance("jdbc:sqlserver://devsql:1433", "pw", "pw", "com.microsoft.sqlserver.jdbc.SQLServerDriver")

try {
def row = sql.firstRow("SELECT [administered_by_employee_id] FROM [MainDevDemo].[dbo].[ph_prescription_order_administration_nl_view]where [ph_prescription_order_administration_id]=${prescription_order_administration_id}")

sql.commit()
sql.close()

testRunner.testCase.setPropertyValue("AdministeredBy", "${row.administered_by_employee_id}")

}catch (Exception e)
{
log.error e;
}


This will return an ID(7EE40BC2-BEC9-11DE-8C8B-00155DCE9F1C) and will save in a test case property, but I want to save this ID in a lowercase.
Appreciated very much if someone can help.

Thanks

2 Replies

  • SiKing's avatar
    SiKing
    Community Expert
    How about something like
    testRunner.testCase.setPropertyValue("AdministeredBy", row.administered_by_employee_id.toString().toLowerCase())