My Products
Help
omelhus
PARTNER

Add _in operator to filters

by omelhus
Status: Implementert

Hey,

 

Would love a _in operator for checking if a value is in a list.

 

Something like this:

 

query Currency($cid: Int!, $currencies: [String]){
  useCompany(no: $cid){
    currency(filter: { isoCode: { _in: $currencies } }){
      ...Currency
    }
  }
}

 

 

Equally with a _not_in operator.

 

4 Comments
omelhus
PARTNER
by omelhus

Bonus for making it work together with the export directive.

omelhus
PARTNER
by omelhus

I see this was implemented in yesterdays release. Thank you!

 

Now please do @export and if the parameter it exports to is an array, append the values to the array as a HashSet.

 

query Currency($cid: Int!, $currencies: [Int!]) {
  useCompany(no: $cid) {
    associate(filter: {currencyNo: {_in: [46, 47]}}) {
      items {
        associateNo
        name
        customerNo
        currencyNo @export(as: "currencies")
      }
    }
    vars: currency(filter: {currencyNo: {_in: $currencies}}) {
      items {
        currencyNo
        isoCode
      }
    }
    currency(filter: {currencyNo: {_in: [46, 47]}}) {
      items {
        currencyNo
        isoCode
      }
    }
  }
}

 

by Marius Bancila

We now have support for _in and _not_in operators in filters. See documentation here: https://docs.business.visma.net/docs/features/filtering

 

omelhus
PARTNER
by omelhus
Status changed to: Status: Implementert

This was implemeted a while ago. Can also be combined with @export to fetch keys from one table and look them up in another.