hi,
I am trying to split a map based on user input
local!data: { a!map(id: 1, name: "Alice", age: 10, city: "New York",school:"NewYork"), a!map(id: 2, name: "Bob", age: 12, city: "Los Angeles",school:"NewYork"), a!map(id: 3, name: "Charlie", age: 13, city: "Chicago",school:"NewYork"), a!map(id: 4, name: "David", age: 14, city: "Houston",school:"NewYork") },
if I give input : age
I should get two
local!data1:{
a!map(id: 1, name: "Alice", age: 10, ),a!map(id: 2, name: "Bob", age: 12, ),a!map(id: 3, name: "Charlie", age: 13, ),a!map(id: 4, name: "David", age: 14, )} and
local!data2:{a!map(city: "New York",school:"NewYork"),
a!map(city: "Los Angeles",school:"NewYork"),a!map(city: "Chicago",school:"NewYork"),a!map(city: "Houston",school:"NewYork")}
is there a way to achieve this , I tried ldrop and rdrop, it doesnt give output as expected
Discussion posts and replies are publicly visible
You can easily iterate on the input maps, and, based on conditions, create two new maps for each.