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