Forum Discussion

_ivanovich_'s avatar
_ivanovich_
Frequent Contributor
5 years ago
Solved

How to use property value in sq with groovy?

Hi,

i have a request with a response.

i transfered a value from the response using Property Transfer into Projetc Properties.

Now i want to use the value from the project property in my sql request:

I tried this:

StringBuilder builder = new StringBuilder()
sql.eachRow("select * from Person where PER_ID = '${#Project#Reqid-received}' ") { row ->
builder.append( "${row.per_id}," ) 
}

it doesn't work for me.

Is the request correct?

Thank you

 

  • I found it, it should be:

     

    def per_id = context.expand('${#Project#Reqid-received}'')

    Then us it in sql like:

    sql.eachRow("select * from Person where PER_ID = "+re_id+" ")

     

    It works. 

1 Reply

  • _ivanovich_'s avatar
    _ivanovich_
    Frequent Contributor

    I found it, it should be:

     

    def per_id = context.expand('${#Project#Reqid-received}'')

    Then us it in sql like:

    sql.eachRow("select * from Person where PER_ID = "+re_id+" ")

     

    It works.