Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rhadall
Engaged Sweeper III

Hi

Is it possible to nest filters in the List of Assets filter? I'm trying to get all Windows devices that are either in the status of Stock or In repair.
I've tried this, but got an invalid operator in condition error .

{
  conjunction: AND,
  conditions: [
    {
      path: "asset.general.type",
      operator: EQUAL,
      value: "Windows"
    },
    {
      conjunction: OR,
      conditions: [
        {
          path: "asset.general.state",
          operator: EQUAL,
          value: "Stock"
        },
        {
          path: "asset.general.state",
          operator: EQUAL,
          value: "In repair"
        }
      ]
    }
  ]
}

Thanks

1 ACCEPTED SOLUTION
Vicente_SC
Moderator
Moderator

Yes, that is possible. You can have a conjunction of conjunctions by grouping them, like this:

{
  conjunction: AND,
  groups: [
  {
   conjunction: AND,
   conditions: [
    {
      path: "asset.general.type",
      operator: EQUAL,
      value: "Windows"
    }
   ]
  },
  {
   conjunction: OR,
   conditions: [
    {
      path: "asset.general.state",
      operator: EQUAL,
      value: "Stock"
    },
    {
      path: "asset.general.state",
      operator: EQUAL,
      value: "In repair"
    }
   ]
  }
 ]
}

These filters are using the same schema than our Public API. You can find more information about how they work here: https://developer.lansweeper.com/docs/data-api/guides/getting-data#filtered-query

View solution in original post

2 REPLIES 2
Vicente_SC
Moderator
Moderator

Yes, that is possible. You can have a conjunction of conjunctions by grouping them, like this:

{
  conjunction: AND,
  groups: [
  {
   conjunction: AND,
   conditions: [
    {
      path: "asset.general.type",
      operator: EQUAL,
      value: "Windows"
    }
   ]
  },
  {
   conjunction: OR,
   conditions: [
    {
      path: "asset.general.state",
      operator: EQUAL,
      value: "Stock"
    },
    {
      path: "asset.general.state",
      operator: EQUAL,
      value: "In repair"
    }
   ]
  }
 ]
}

These filters are using the same schema than our Public API. You can find more information about how they work here: https://developer.lansweeper.com/docs/data-api/guides/getting-data#filtered-query

rhadall
Engaged Sweeper III

Thanks. I tried groups and couldn't get it to work - looks like my syntax was wrong.

Forum

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now