Forum Discussion
Yeah, I got that.
What I am trying to do is if the parameter is given an expression will it evaluate it?
If we give an xpath or json path (whose value will be in the document that the pipeline receives) will the xpath be populated with correct values?
Yes definitely. It should!!
- krupalibshah8 years agoContributor
I made this simple pipeline to test,
input :
{ "firstName": "John", "lastName" : "doe", "age" : 26, "address" : { "streetAddress": "naist street", "city" : "Nara", "postalCode" : "630-0192" }, "phoneNumbers": [ { "type" : "iPhone", "number": "0123-4567-8888" }, { "type" : "home", "number": "0123-4567-8910" } ] }
the response I get is,
[{ "firstName": "John", "lastName": "doe", "age": 26, "address": { "streetAddress": "naist street", "city": "Nara", "postalCode": "630-0192" }, "phoneNumbers": [ { "type": "iPhone", "number": "0123-4567-8888" }, { "type": "home", "number": "0123-4567-8910" } ], "a": { "a": "pipe.label", "payload1": "$", "REMOTE_ADDR": "35.156.60.10", "xpath_city": "/root/address/city", "HTTP_DATE": "", "REMOTE_USER": "", "HTTP_REFERER": "", "REMOTE_PORT": "", "QUERY_STRING": "", "payload": "$", "CONTENT_TYPE": "application/json", "HTTP_ACCEPT": "", "REQUEST_METHOD": "POST", "jsonpath": "$.address.city", "HTTP_USER_AGENT": "Apache-HttpClient/4.1.1 (java 1.5)", "HTTP_ACCEPT_ENCODING": "", "PATH_INFO": "" }, "b": false }]
TestParam_2017_11_10.slp (2.5 KB)
The xpath or json path are not getting evaluated.
- del8 years agoContributor III
@krupalibshah, I think the eval() function is what you’re looking for. See if the following additions to your mapper help point you in the right direction.
- tstack8 years agoFormer Employee
Yes, the eval() function should be used to dynamically evaluate an expression. There is also jsonPath() function to dynamically evaluate a JSON-Path.
- krupalibshah8 years agoContributor
Can you give me an example?
- nganapathiraju8 years agoFormer Employee
Here is what works.
eval-pipeline-params_2017_11_13.slp (3.3 KB)
- krupalibshah8 years agoContributor
In your example, I see pipeline parameter with json path.
If we capture its value, and invoke the pipeline via a triggered task, will the parameter be evaluated to value 10 and the same will be shown under pipeline parameter in execution statics?