Reputation: 1
Hi I have some tags with similar names that I would like to filter by name.
I have some with the word “return” in them, I don't want to use them, but the tags with the word “active” should be used.
I have created it in a table to illustrate what I mean.
aba_return_active | ab_active | ab_return | ab | aba_active |
---|---|---|---|---|
Cell 1 | Cell 2 | Cell 3 | Cell 4 | Cell 5 |
After the filter it should look like this.
ab_active | aba_active |
---|---|
Cell 2 | Cell 5 |
And is it possible to search for multiple strings in the query? e.g. “active”, “PV” and “work”
Many thanks for your help!
Kind regards
Upvotes: 0
Views: 63
Reputation: 144
You can use regular expressions in keep function so as to keep only columns that you need.
See an example for your test data:
import "array"
array.from(rows:[{ aba_return_active : "Cell 1",
ab_active : "Cell 2",
ab_return : "Cell 3",
ab : "Cell 4",
aba_active : "Cell 5"}])
|> keep(fn: (column) => column =~ /active/)
Upvotes: 0