79502592

Date: 2025-03-12 03:51:28
Score: 1
Natty:
Report link

Is it possible to do for multiple inputs ?

Yes, it is possible with multiple inputs. Try by using mv-apply key = input iterates over each value in input and tostring(key) ensures each input key is treated as a string. In below code pack(tostring(key), b.value1) is used, which creates { "input1": b.value1, "input2": b.value1 } dynamically. Now make_bag() aggregates the results into a single dynamic object per row.

let T = datatable(a:string, b:dynamic)
[
    "hello", dynamic({"A":1,"B":2,"value1":3}),
    "world", dynamic({"value1":4,"value2":5})
];

let input = dynamic(["input1", "input2"]);

T
| mv-apply key = input on 
(
    summarize new_output_column = make_bag(pack(tostring(key), b.value1))
)

Output: enter image description here

Reasons:
  • Blacklisted phrase (1): Is it possible to
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): Is it
Posted by: Balaji