Hi all,
I’m having struggles realizing something in Alumio and I am hoping someone has a handy tip for this.
I am trying to remove a parent node based on a child condition.
Here is my example data:
"data" : [
0:{
"check" : "good",
"data" : "more data"
}
1:{
"check" : "bad",
"data" : "more data"
}
2:{
"check" : "good",
"data" : "more data"
}
]
I want to delete node with where the value of check == bad.
So in this case node 1 should be removed.
An PHP equivalent would be:
<?php
$array = [
0 => [
"check" => "good",
"data" => "more data"
],
1 => [
"check" => "bad",
"data" => "more data"
],
2 => [
"check" => "good",
"data" => "more data"
]
];
foreach($array as $key => $value){
if($value['check'] == "bad"){
unset($array[$key]);
}
}
print_r($array);
?>
Results:
Array
(
[0] => Array
(
[check] => good
[data] => more data
)
[2] => Array
(
[check] => good
[data] => more data
)
)
It looks so trivial to do, but I cannot seem to find a way to do this in Alumio.
I must be overlooking something that can do this trick.
Anyone that has pointers in this case?