Forum Discussion

Arjan's avatar
Arjan
New Contributor
9 years ago
Solved

How can I use a variable in Property transfer?

I want to use a variable in the Property transfer screen. I use JSONPATH to extract an ID (see screenshot)

I use the variable: invoice_id = 1041

 

When I use the following JSONPATH expression I get the desired result in Property Transfer:

"$.[?(@.invoice_id==1041)]id[0]"

 

See Attachment: Desired Result

 

The problem is that '1041' is dynamic so I want to get value '1041' out of another property saved under the testcase:  

'${#TestCase#invoice_id}'

 

Therefore I use the following JSONPATH expression:

"$.[?(@.invoice_id==${#TestCase#invoice_id})]id[0]"

 

But now I get the error message: For input string: "${#TestCase#invoice_id}" See Attachment: Error

 

NOTE: When I use the same JSPATH expression in a assertion it works just fine.

 

Is there another way to get the same result? Or how is it possible to use a variable in Property Transfer.