How do I select multiple field columns with flux?

equivalent influxQL:

SELECT a, b where a = 'hello' and b > 10;

@manoj_m, you’d do it with filter():

// ...
  |> filter(fn: (r) => r.a == "hello" and r.b > 10)

@scott Is this correct for value-fields (no-tag fields)? I am trying to execute a simple select via Chronograf but it does not seem to be working the way you explained.

Assumed I would have inserted data with
insert test a=10,b=40
insert test a=20,b=30
insert test a=20,b=40

Now I want to retrieve BOTH a and b variables of the second datapoint.
This is very simple in influx:
select a,b from test where a>10 AND b=30

But I have absolutely no idea how to acomplish this in flux?
At least via Chronograf it appears that every value is returned as stand-alone and can be addressed via _field for field name and _value for the actual value.

This gets me to:

from(bucket: "test/autogen")
|> range(start: MyStartTime, stop: MyEndTime)
|> filter(fn: (r) => r._measurement == "test" )
|> filter(fn: (r) => r._field == "a" )
|> filter(fn: (r) => r._value > 10)

But I have no idea how to combine this with the value of field b. Your solution suggests to use
r.a, r.b but this does not work in case a, b are regular fileds.

Any help would be greatly appreciated!

Sorry, I’m not sure why, but in my initial answer I assumed a and b were tags, not fields. You can use pivot() to pivot a and b fields into the same rows:

from(bucket: "test/autogen")
  |> range(start: MyStartTime, stop: MyEndTime)
  |> filter(fn: (r) => r._measurement == "test" and r._field =~ /a|b/ )
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> filter(fn: (r) => r.a > 10 and r.b == 30)

@scott Thanks a lot for your speedy reply! It works perfectly now!

@Aga-Schwarz Happy to help!