1

Dataset:

Lastnotes,Status,PeriodStart,PeriodEnd,Client
worked on assignment and completed,Completed,1/1/2022,1/31/2022,JohnSmith
worked on assignment and finished it,Completed,1/1/2022,1/31/2022,JaneDoe
stalled,InProg,2/1/2022,2/28/2022,JohnSmith

I presently have an array of objects with each objects formed as follows:

var TheObject = {
  group: element.Client,
  data: [{
    label: element["LastNotes"],
    data: [{
      timeRange: [element["PeriodStart"], element["PeriodStart"]],
      val: element.Status
    }, ]
  }, ],
};

In the end, I get:

var TheObject = {group: "JaneDoe: [{label: "worked on assignment and finished it",data: [{timeRange: ["1/1/2022","1/31/2022"],val: "Completed"},]},],};

...and then two more for the other two items.

Is there some way I can group by Client so that the two JohnSmith entries become:

var TheObject = {group: "JohnSmith: [{label: "worked on assignment and finished it",data: [{timeRange: ["1/1/2022","1/31/2022"],val: "Completed"},]},{label: "stalled",data: [{timeRange: ["2/1/2022","2/28/2022"],val: "InProg"},]}],};
2
  • Your quoting is messed up in the results. Commented Jul 21, 2022 at 7:16
  • Thanks. I'll check the solution once I get back. Commented Jul 21, 2022 at 13:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.