cancel
Showing results for 
Search instead for 
Did you mean: 

Check If Data Is Missing

alstef
New Contributor

I’m getting data out of a REST call and I need to check whether or not a certain entry is present or missing. My list of needed entries consists of, example: String1, String2, String3, String4. If only the the first three are present, how do I print out that String4 is missing in my entries and how do i filter duplicates, for example String1 = String2 (I need to print the name of the duplicate)? I have tried using the Conditional snap, but haven’t had any success so far. Any suggestions? Thank you.

5 REPLIES 5

anubhav_nautiya
Contributor

could you please share the JSON of the rest output

alstef
New Contributor

[
{
“all”: “Error|Dimension|Error|Dimension|Error|Deals|Error|Re|Error|Rem|Error|Supplier|Error|ranches”
}
]

this is the JSON after mapping and aggregate, now I need to separate the Dimension and count it, and how do I print that “Shopping” is missing in the “all”

alstef
New Contributor

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