Array Mapping with complex filtering

Hello guys,
I can’t get some specs for the map function… I am starting to become crazy…
Do you know how I can filter an array with a (quite simple) function.
For example, I have multiple bundles coming from an iterator and I need to filter it to some bundle where an attribut is empty. Even better, count the empty values from multiple bundles…
Please help me :frowning:

1 Like

Without a context is hard to know the answer for your question.

For now, I will use:

Let’s suppose you have the array:

{
   "array":[
      {
         "_id":"6297e0c93e45a61c337d69b2",
         "index":0,
         "guid":"a6a4e42d-0a17-4b60-930b-196ba94aa0a5",
         "isActive":false,
         "balance":"$1,970.98",
         "age":29,
         "eyeColor":"green",
         "name":"Espinoza Montgomery",
         "email":"espinozamontgomery@neptide.com",
         "tags":[
            "tempor",
            "quis",
            "magna",
            "non",
            "laborum",
            "amet",
            "reprehenderit"
         ],
         "friends":[
            {
               "id":0,
               "name":"Velasquez Spencer"
            },
            {
               "id":1,
               "name":"Suzanne Griffin"
            },
            {
               "id":2,
               "name":"Wagner Rich"
            }
         ]
      },
      {
         "_id":"6297e0c95264dd56074b88b5",
         "index":1,
         "guid":"7231bf65-a839-4cb7-acf6-6046bf472b71",
         "isActive":false,
         "balance":"$1,704.51",
         "age":23,
         "eyeColor":"blue",
         "name":null,
         "email":"lydiahughes@neptide.com",
         "tags":[
            "in",
            "non",
            "cupidatat",
            "tempor",
            "nostrud",
            "aliquip",
            "ad"
         ],
         "friends":[
            {
               "id":0,
               "name":"Mayra Dyer"
            },
            {
               "id":1,
               "name":"Lynne Bush"
            },
            {
               "id":2,
               "name":"Horton Young"
            }
         ]
      },
      {
         "_id":"6297e0c9140404acb0c99a7b",
         "index":2,
         "guid":"659ba486-6174-4d87-98e2-0fb328a52e62",
         "isActive":true,
         "balance":"$1,440.16",
         "age":38,
         "eyeColor":"blue",
         "name":"Lott Landry",
         "email":"lottlandry@neptide.com",
         "tags":[
            "minim",
            "sint",
            "irure",
            "id",
            "enim",
            "qui",
            "deserunt"
         ],
         "friends":[
            {
               "id":0,
               "name":"Leticia Reid"
            },
            {
               "id":1,
               "name":"Anderson Cummings"
            },
            {
               "id":2,
               "name":"Dollie Velez"
            }
         ]
      },
      {
         "_id":"6297e0c98aeecd058821e5ff",
         "index":3,
         "guid":"e94cfd9f-afbe-4722-8641-6c032eceba20",
         "isActive":false,
         "balance":"$3,322.37",
         "age":20,
         "eyeColor":"blue",
         "name":null,
         "email":"ollielivingston@neptide.com",
         "tags":[
            "officia",
            "id",
            "commodo",
            "adipisicing",
            "reprehenderit",
            "consectetur",
            "proident"
         ],
         "friends":[
            {
               "id":0,
               "name":"Griffin Gentry"
            },
            {
               "id":1,
               "name":"Adela Elliott"
            },
            {
               "id":2,
               "name":"Norma Allen"
            }
         ]
      },
      {
         "_id":"6297e0c9fbb36364723a729e",
         "index":4,
         "guid":"b8f73069-fb8a-40a4-8ac8-6be302105045",
         "isActive":true,
         "balance":"$3,249.49",
         "age":38,
         "eyeColor":"green",
         "name":"Spears Justice",
         "email":"spearsjustice@neptide.com",
         "tags":[
            "et",
            "id",
            "voluptate",
            "commodo",
            "culpa",
            "irure",
            "cupidatat"
         ],
         "friends":[
            {
               "id":0,
               "name":"Rosemarie Logan"
            },
            {
               "id":1,
               "name":"Greer Mckenzie"
            },
            {
               "id":2,
               "name":"Bridgette Pacheco"
            }
         ]
      },
      {
         "_id":"6297e0c96e73343d6f7fdb41",
         "index":5,
         "guid":"b1d8518c-b940-4259-8c4f-1976d18374c8",
         "isActive":true,
         "balance":"$3,737.63",
         "age":37,
         "eyeColor":"blue",
         "name":"Kasey Little",
         "email":"kaseylittle@neptide.com",
         "tags":[
            "duis",
            "velit",
            "eiusmod",
            "aute",
            "aute",
            "adipisicing",
            "aute"
         ],
         "friends":[
            {
               "id":0,
               "name":"Dodson Patel"
            },
            {
               "id":1,
               "name":"Roach Mckinney"
            },
            {
               "id":2,
               "name":"Kim Church"
            }
         ]
      }
   ]
}

Reference: JSON Generator – Tool for generating random data (json-generator.com)

The blueprint attached can be used to import and see a few operations using the array:

array_map_interactions.json (36.3 KB)

1 Like

Thanks a lot for the try.
You understand right… but I see in your example that you are stuck where I am, right ?
I am trying to count the number of empty name attribut. It is the same problem in your blueprint right ?
Thanks again for your help.

Yeah, same as you when tried to use map because the option to filter an attribute doesn’t work with null or emptystring.
The only option I see is using Iterator and Filter.

So, from my point of view, It’s not possible to count or filter using map.

Maybe you can send a message to the Support Team asking about the situation as showed below:

Hi
You could also to a quick replace before the map, in order to replace the empty attributes with “MYFILTER” then filter on MYFILTER.