cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using the AND Operator For Multiple Filter Conditions

victor_correa
Visitor

I need to run a query with 3 conditions for the ":filter" command, and I am having a hard time with the syntax.

This is the base query that I am working off of:

1    builtin:tech.generic.mem.workingSetSize
2    :filter(in("dt.entity.process_group_instance",entitySelector("type(process_group_instance),entityName(~"Oracle Database~")")))
3    :parents:splitBy("dt.entity.host"):avg:sort(value(avg,descending))
4    :filter(in("dt.entity.host", entitySelector("type(~"HOST~"),tag(~"TYPE:Oracle Database Server~")")))

It returns all results without any issues, but I need to add another condition for filtering. I have built the condition separately and I have tried to add the line below, to no avail:

5    :filter(in("dt.entity.host", entitySelector("type(~"HOST~"),tag(~"Capability:Global Money Transfer~")")))

I am assuming that there might be a conflict between the multiple ":filter" instances and the way around would be using the AND operator, but I am struggling so hard with the syntax that I was hoping to get a little guidance from the community.

2 REPLIES 2

victor_balbuena
Dynatrace Mentor
Dynatrace Mentor

If you need a host to have both the tags TYPE:Oracle Database Server and Capability:Global Money Transfer, then you can merge your filters in step 4 and 5 with an and as you suggest in the following way:

:filter(and(in("dt.entity.host", entitySelector("type(~"HOST~"),tag(~"TYPE:Oracle Database Server~")")),in("dt.entity.host", entitySelector("type(~"HOST~"),tag(~"Capability:Global Money Transfer~")"))))

If you need hosts that have any of the tags, then you can just do:

:filter(in("dt.entity.host", entitySelector("type(~"HOST~"),tag(~"TYPE:Oracle Database Server~",~"Capability:Global Money Transfer~")")))

Hopefully this helps.

Hey Victor,

Thanks for replying. I guess the Victors stay together. LoL

I have tried the query with the AND operator, but for some reason, it doesn't return any data. I ended up using Dynamic Filters for the Capability, since the value would be universal for all tiles in the Dashboard, so I don't need the filter in the query themselves.

But I appreciate you taking the time to help out.

Featured Posts