Forum Discussion
Here’s a sample JSON similar to the one I’m working with. I want to check with each execution whether or not for example if “label” contains Pipeline_2 or not. After that, I want to print out a message that “Pipeline_2” is missing.
[
{
“statusLine”:{
“protoVersion”:“HTTP/1.1”,
“statusCode”:200,
“reasonPhrase”:“OK”
},
“entity”:{
“response_map”:{
“entries”:[
{
“pipe_id”:“111”,
“has_lints”:false,
“documents”:0,
“ccid”:“121”,
“child_has_lints”:false,
“parent_ruuid”:“122”,
“subpipes”:{
},
"state_timestamp":"2010-10-10",
"error_documents":0,
"label":"Pipeline_1",
"state":"Completed",
"create_time":"2010-10-10",
"invoker":"error_handler",
"duration":1067,
"id":"125",
"mode":"standard"
},
{
"pipe_id":"222",
"has_lints":false,
"documents":3767064,
"child_has_lints":false,
"parent_ruuid":null,
"subpipes":{
},
"state_timestamp":"2010-12-12",
"error_documents":0,
"label":"Pipeline_2",
"state":"Completed",
"create_time":"2010-12-12",
"invoker":"triggered",
"duration":1074,
"id":"212",
"mode":"standard"
}
…
]
Hello @alstef
Regarding the check whether or not, “label” contains Pipeline_2 , one way of doing that is by ternary operator in the mapper snap. For the above mentioned example that you pointed out, the solution would be $label.contains( ‘Pipeline_2’) ? $label : ‘Pipeline_2 is missing’ or if you want strict check on the name of the string, than you can do $label == ‘Pipeline_2’ ? $label : ‘Pipeline_2 is missing’
Regards
Dimche
- agarwal_rohit2 years agoNew Contributor
Szymon - Did you get any solution for this? I am also looking for the same
Related Content
- 11 months ago
- 6 months ago
- 3 years ago
- 4 years ago