1

I'm using GraphQL with .NET Core. I have query like below. As I'm new in GraphQL.NET, I can't understand how to group individual key as array.

`{
    readingQuery{
             readingsDBFilter(buildingId: 30, objectId: 1, datafieldId: 1, startTime: "02-05-201812-00-00-AM", endTime: "30-05-201811-59-00-PM"){
                             value,
                            unix
                        }
    }
}`    

I have Output Like this

`{
    "data": {
        "readingQuery": {
            "readingsDBFilter": [
               {
                    "value": 0.66,
                    "unix": 1525254180000
                },
                {
                    "value": 0.68,
                    "unix": 1525254240000
                }
           ]
       }
   }
}`

But, Is it possible to return result like this from query.

`{
    "data": {
        "readingQuery": {
            "readingsDBFilter": [
                {
                    "value":[ 0.66, 0.68],
                    "unix": [1525254180000, 1525254240000]
                }
            ]
        }
    }
}`
Saiful Islam
  • 186
  • 1
  • 3
  • 13
  • Did you ever find a solution for this in GraphQL? I too am interested in how to do what you describe. – Redink Aug 29 '22 at 18:35

1 Answers1

0

Looks like you need to group values from different records I guess you have two option here 1) try to group it on SQL level (maybe better to create dateview) 2) do it on runtime level, in code. from my point of view - it's bad. any grouping in code it's much slower then the same operation in db-level

Dmitriy
  • 124
  • 2