0
how can I create a group of objects where the id_question is equal within a $.each ?
Object {id_pergunta: "63", resposta: "não", qtd: "5"}
Object {id_pergunta: "63", resposta: "sim", qtd: "19"}
Object {id_pergunta: "64", resposta: "não", qtd: "19"}
Object {id_pergunta: "65", resposta: "A", qtd: "12"}
Object {id_pergunta: "65", resposta: "B", qtd: "1"}
Object {id_pergunta: "65", resposta: "C", qtd: "2"}
Object {id_pergunta: "65", resposta: "D", qtd: "3"}
Object {id_pergunta: "65", resposta: "E", qtd: "1"}
Object {id_pergunta: "66", resposta: "não", qtd: "11"}
Object {id_pergunta: "66", resposta: "sim", qtd: "8"}
Example : In this case the two id s are equal and would be placed in the same object.
[{id_pergunta: "63", resposta: "não", qtd: "5"},{id_pergunta: "63", resposta:"sim", qtd: "19"}]
you have these values in what format? They are in an array and you want to separate in arrays by question? or would you like to map to a different object? type { [id_question] { [answer] [Qtd] }, ... } ??
– Israel Merljak
Hello Israel, this in Json format, in case I will popular canvas Graphics and for each group of id_question will be generated a graphic.
– Carlos Lopes
Carlos Beauty. take a look at the reply I sent, I believe it serves this purpose, since it is grouping the questions and their answers in a structured way.
– Israel Merljak
It worked perfectly!! Thank you very much Israel!
– Carlos Lopes