Solved

FDM - Querying using multiple filters

  • 25 November 2022
  • 3 replies
  • 124 views

Userlevel 1

Hello All,

I am trying to query the FDM schema after populating (listForecast in slb-pdf project). But i am getting the error! seems like an bug. Can you check if I am doing something wrong.

query MyQuery {
  listForecast(filter: {oilRate: {eq: 1.5}, and: {gasRate: {eq: 1.5}}}) {
    edges {
      node {
        id
      }
    }
  }
}

 

Error I am getting is as below. Can you help if known bug or if I should do differently?
 "message": "Expected either 'and', 'or', 'not' or a single field condition used in the same filter block.",

icon

Best answer by Vu Hai Nguyen 25 November 2022, 10:40

View original

3 replies

Userlevel 1
Badge

Hi,

Your query syntax is not correct. I think if you want the and condition on both oil Rate and gasRate it should be:
filter: { and: [{oilRate: {eq: 1.5}}, {gasRate:{eq:1.5}}]}

Userlevel 1

Thanks Vu Hai Nguyen, I was using the UI to built the query but did not worked somehow.
Thanks for your input, it works!

Userlevel 4

We are working on making the filter builder to be more robust to capture this ability to build “list” of `and` and `or` filters :) Hope the workaround in code will work in the mean time!

Reply