Forum Discussion

alstef's avatar
alstef
New Contributor
6 years ago

Check If Data Is Missing

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

  • alstef's avatar
    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's avatar
    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"
               }
    


    ]

    • dimche_saveski's avatar
      dimche_saveski
      New Contributor III

      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