If I have an array like this
var array = [
{name: "Source_one", alertName: "Alert_1"},
{name: "Source_three", alertName: "Alert_2"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_two", alertName: "Alert_3"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_two", alertName: "Alert_1"},
{name: "Source_one", alertName: "Alert_1"},
{name: "Source_two", alertName: "Alert_1"},
{name: "Source_two", alertName: "Alert_2"},
{name: "Source_one", alertName: "Alert_1"},
{name: "Source_two", alertName: "Alert_2"},
{name: "Source_three", alertName: "Alert_3"},
{name: "Source_two", alertName: "Alert_2"},
{name: "Source_two", alertName: "Alert_3"},
{name: "Source_three", alertName: "Alert_1"},
{name: "Source_three", alertName: "Alert_1"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_three", alertName: "Alert_2"},
{name: "Source_three", alertName: "Alert_2"},
{name: "Source_two", alertName: "Alert_1"},
{name: "Source_three", alertName: "Alert_3"}
]
how can I do if I want to know how may times each point happens for a single alert?
I would like to create this kind of output:
var output = [
{name: "Source_one", alertName: "Alert_1", frequency:3},
{name: "Source_one", alertName: "Alert_3", frequency:4},
{name: "Source_two", alertName: "Alert_1", frequency:3},
{name: "Source_two", alertName: "Alert_2", frequency:3},
{name: "Source_two", alertName: "Alert_3", frequency:2},
{name: "Source_three", alertName: "Alert_1", frequency:2},
{name: "Source_three", alertName: "Alert_2", frequency:3},
{name: "Source_three", alertName: "Alert_3", frequency:2}
]
I really have no clue how to do that. Thanks for your help