Some() and every() graphql?

I know I’ve used “some” for filtering nested data which is useful, but is there something like “some” for aggregating?

For example, I use JavaScript some() to reduce nested items:

flag: tasks.items.some(task => task.flag),

I see fn and aggregate in the docs, but not sure if it needs to be used with groupBy. some() is just count > 0.

Ok, I think I got it. It’s a bit hard to remember with the 4-deep nested structure of groupBy > query > flag > fn, but I know it has to be in some graphql syntax.

query {
  task(taskId: "273") {
    blocks(
      groupBy: {
        query: {
          flag: {
            as: "some",
            fn: {
              aggregate: COUNT
            }
          }
        }
      }
    ) {
      groups {
        some: Int
      }
    }
  }
}

Hey @mike_ekim1024!

Do you feel like you got your arms around this one?

I’d say approaching this using both GroupBy and the then the Having or Filter property is the way to go.

1 Like

Yes, I think I understand it, it’s just a lot of text. I guess this can be converted to a function.