Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Expression with 3 option results

I am having some trouble while trying to represent three diferent scenarios while using a expression.

So:

id_inc2 column is the place where I get numbers/data

if they exist I want to represent them on a image, depending on the type

When I say type, I mean IA_Tipo_de_Evento

Each type should show up a image:

'qmem://<bundled>/BuiltIn/led_y.png' is for IA_Tipo_de_Evento='Lentidão'

'qmem://<bundled>/BuiltIn/led_y.png' is for IA_Tipo_de_Evento='Erro Aplicacional'

'qmem://<bundled>/BuiltIn/led_y.png' is for IA_Tipo_de_Evento='Dificuldade de Acesso'

'qmem://<bundled>/BuiltIn/led_r.png' is for IA_Tipo_de_Evento='Indisponibilidade'

'qmem://<bundled>/BuiltIn/led_g.png' is for none of the previous examples

SO far, the following expression I created shows only the empty results and the IA_Tipo_de_Evento Lentidão, Erro Aplicacional and Dificuldade de Acesso.

if(Count(id_inc2)<>(IA_Tipo_de_Evento='Indisponibilidade'),'qmem://<bundled>/BuiltIn/led_y.png' ,'qmem://<bundled>/BuiltIn/led_g.png')

Could you please help me building the expression to show up something like:

if empty,  show image 'qmem://<bundled>/BuiltIn/led_g.png'

if IA_Tipo_de_Evento diferent then Indisponibilidade show image 'qmem://<bundled>/BuiltIn/led_y.png'

If IA_Tipo de Evento is Indisponibilidade show image 'qmem://<bundled>/BuiltIn/led_r.png'

All in the same expression, not separated expressions.

Many thanks for all your help!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Nevermind, found myself the answer by using this expression:

=If(IA_Tipo_de_Evento='Indisponibilidade', 'qmem://<bundled>/BuiltIn/led_r.png',

If(IA_Tipo_de_Evento='Lentidão', 'qmem://<bundled>/BuiltIn/led_y.png',

If(IA_Tipo_de_Evento='Erro Aplicacional', 'qmem://<bundled>/BuiltIn/led_y.png',

If(IA_Tipo_de_Evento='Dificuldade de Acesso', 'qmem://<bundled>/BuiltIn/led_y.png'))))

View solution in original post

4 Replies
swuehl
MVP
MVP

In general, you should use aggregation functions in expressions:

Use Aggregation Functions!

If you just write (IA_Tipo_de_Evento='Indisponibilidade'), the value of IA_Tipo_de_Evento may not be unambiguous in the context you are using the field in. But to answer that, you need to provide more information:


What is the context your using this expression in? A chart with dimensions, and if so, which dimensions? How does your data model look like?

Could you post some sample lines of data or a small sample QVW?

Anonymous
Not applicable
Author

Please let me know if this attached sample helps you. Thanks.

Anonymous
Not applicable
Author

Nevermind, found myself the answer by using this expression:

=If(IA_Tipo_de_Evento='Indisponibilidade', 'qmem://<bundled>/BuiltIn/led_r.png',

If(IA_Tipo_de_Evento='Lentidão', 'qmem://<bundled>/BuiltIn/led_y.png',

If(IA_Tipo_de_Evento='Erro Aplicacional', 'qmem://<bundled>/BuiltIn/led_y.png',

If(IA_Tipo_de_Evento='Dificuldade de Acesso', 'qmem://<bundled>/BuiltIn/led_y.png'))))

swuehl
MVP
MVP

I am unsure what you are trying to achieve. If I add some expressions to show the count and the content of IA_Tipo_de_Evento

= If(WildMatch5(subcategory_rc, 'SHARE DE REDE'), 'Shares', If(WildMatch5(subcategory_rc, 'CONTA DE REDE'), 'Acessos', If(WildMatch5(subcategory_rc, 'SERVIÇO DE PROXY'), 'Proxy', If(WildMatch5(subcategory_rc, 'SERVIDOR FILAS ESPERA'), 'Impressoras', If(WildMatch5(subcategory_rc, 'SERVIÇO DE IMPRESSÃO'), 'Impressoras', If(WildMatch5(subcategory_rc, 'SERVIDOR APLICACIONAL'), 'Shares', If(WildMatch5(subcategory_rc, 'SERVIDOR DE FICHEIROS'), 'Shares', If(WildMatch5(subcategory_rc, 'SERVIDOR APLICACIONAL'), 'Acessos', If(WildMatch5(subcategory_rc, 'VPN'), 'VPN', If(WildMatch5(subcategory_rc, 'TIPO 1 (INT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'CORE (PT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'TIPO C (PT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'BACKBONE (INT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'REDE LOCAL FIXA (NAC)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'TIPO B (PT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'REDE LOCAL FIXA'), 'Conectividade', If(WildMatch5(subcategory_rc, 'CHICOTE DE REDE'), 'Conectividade', If(WildMatch5(subcategory_rc, 'BACKBONE (PT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'INTERLIGAÇÃO DATA CENTER'), 'Conectividade', If(WildMatch5(subcategory_rc, 'FALHA DE SEGURANÇA'), 'Conectividade', If(WildMatch5(subcategory_rc, 'INTERNET (INT)'), 'Proxy', If(WildMatch5(subcategory_rc, 'INTERNET (PT)'), 'Proxy', If(WildMatch5(subcategory_rc, 'REDE LOCAL FIXA (ACE)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'REDE LOCAL WIRELESS (ARMAZÉNS EDP)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'CHICOTE DE REDE (ACE)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'TIPO 3 (INT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'TIPO A (PT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'INTERLIGAÇÃO FORA DO DATA CENTER'), 'Conectividade', If(WildMatch5(subcategory_rc, 'TIPO 2 (INT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'AGENTE (PT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'REDE LOCAL WIRELESS'), 'Conectividade', If(WildMatch5(subcategory_rc, 'CORE (INT)'), 'Conectividade', If(WildMatch5(subcategory_rc, 'ACCESO A RED DE HC'), 'Conectividade', subcategory_rc))))))))))))))))))))))))))))))))) count(id_inc2) IA_Tipo_de_Evento concat(IA_Tipo_de_Evento,', ')
VPNqmem://<bundled>/BuiltIn/led_g.png0
Proxyqmem://<bundled>/BuiltIn/led_g.png0
Sharesqmem://<bundled>/BuiltIn/led_g.png0
Acessosqmem://<bundled>/BuiltIn/led_g.png0
Impressorasqmem://<bundled>/BuiltIn/led_g.png0
Conectividadeqmem://<bundled>/BuiltIn/led_y.png1LentidãoLentidão

It seems like Conectividade is the only one with a count <> 0 ('value exists') and a related IA_Tipo_de_Evento.

So your expression seems to work for me, fulfilling the requirement you described above.

Though I would write the expresssion like

=If(Count(id_inc2)>0,

    If (Match(Only(IA_Tipo_de_Evento), 'Lentidão','Erro Aplicacional','Dificuldade de Acesso'),'qmem://<bundled>/BuiltIn/led_y.png',  

    If(Only(IA_Tipo_de_Evento) ='Indisponibilidade' ,'qmem://<bundled>/BuiltIn/led_y.png')), 'qmem://<bundled>/BuiltIn/led_g.png')