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

Entity Tags DQL

Pablo2
Participant
I have a DQL that shows a series of fields that I am interested in, one of them is entity_tags.
But I only want one of the tags to appear in that field, not all of them (if it has that tag) otherwise I want an empty or null to appear.
 
This is the DQL:
 
fetch dt.davis.problems
| filter isNull(dt.davis.is_duplicate) OR NOT dt.davis.is_duplicate
| filter in(labels.alerting_profile, "[AESM] Alertas_24x7")
| fields display_id, event.name, event.status, event.description,entity_tags, event.start, event.end, event.id, dt.davis.problems, affected_entity_ids, affected_entity_types,root_cause_entity_name
| expand affected_entity_ids
| lookup
[
fetch dt.entity.host
| fieldsAdd osType
], sourceField:affected_entity_ids, lookupField:id, fields:{osType}
| expand affected_entity_ids
| lookup
[
fetch dt.entity.synthetic_test
| fieldsAdd entity.name
], sourceField:affected_entity_ids, lookupField:id, fields:{entity.name}
| fieldsRemove event.status
| fieldsAdd ids_sorted = arraySort(affected_entity_ids, direction:"ascending")
| fields `Activo`=problems,Inicio=event.start, Fin=event.end,entity_tags,display_id, Tipo=event.name,Monitor=entity.name, osType,Causa_Raiz=root_cause_entity_name,Descripcion=event.description, event.id
| sort Inicio desc
| dedup event.id, sort:{Monitor}
| fieldsAdd Monitor = if(isNull(Monitor), "KeepAlive", else:Monitor)
| fieldsAdd osType = if(isNull(osType), "N/A", else:osType)
| fieldsAdd Causa_Raiz = if(isNull(Causa_Raiz), "No determinada", else:Causa_Raiz)
 
This is the actual table:
Pablo2_0-1749719985882.png

 

1 REPLY 1

TracingMySanity
Observer

The `entity_tags` field is an array, so you should be able to expand it and then filter on specific tag(s). 

fetch dt.davis.problems
| filter isNull(dt.davis.is_duplicate) OR NOT dt.davis.is_duplicate
| fields display_id, event.name, event.status, event.description,entity_tags, event.start, event.end, event.id, dt.davis.problems, affected_entity_ids, affected_entity_types,root_cause_entity_name
| expand entity_tags
| filter in(entity_tags, {"AESM_App_Purpose:NED", "AESM_App_Purpose:AreaClienteAXA"})

 

Featured Posts