Estou tentando fazer uma um filtragem no E3Alarm, por vários parâmetros:
Intervalo de datas (está funcionando)
FullAlarmSourceName (está funcionando)
Severity (não está funcionando, mesmo passando um valor inteiro de -2 a 2 através da variável severity)
EventCategory (não está funcionando)
Operator (está funcionando)
Abaixo segue trecho do código que realiza filtragem:
'Filtra intervalo de datas e tag escolhida
If tag.Value <> "" And sev.SelText = "" And tabela.SelText = "" And msg.Value = "" And ope.Value = "" Then
txtFiltro = txtFiltro & " And InStr(FullAlarmSourceName, " & Chr(34) & UCase(tag.Value) & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, tag e seveidade
ElseIf tag.Value <> "" And sev.SelText <> "" And tabela.SelText = "" And msg.Value = "" And ope.Value = "" Then
txtFiltro = txtFiltro & " And InStr(FullAlarmSourceName, " & Chr(34) & UCase(tag.Value) & Chr(34) &")" & "> 0 And Severity = " & severity
'Filtra intervalo de datas, tag, severidade, tabela
ElseIf tag.Value <> "" And sev.SelText <> "" And tabela.SelText <> "" And msg.Value = "" And ope.Value = "" Then
txtFiltro = txtFiltro & " And InStr(FullAlarmSourceName, " & Chr(34) & UCase(tag.Value) & Chr(34) &")" & "> 0 And Severity = " & severity & _
" And Instr(EventCategory, " & Chr(34) & tab & Chr(34) &")> 0"
'Filtra intervalo de datas, tag, severidade, tabela e mensagem
ElseIf tag.Value <> "" And sev.SelText <> "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value = "" Then
txtFiltro = txtFiltro & " And InStr(FullAlarmSourceName, " & Chr(34) & UCase(tag.Value) & Chr(34) &")" & "> 0 And Severity = " & severity & _
" And Instr(EventCategory, " & Chr(34) & tab & Chr(34) &")> 0" & " And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, tag, severidade, tabela, mensagem e operador
ElseIf tag.Value <> "" And sev.SelText <> "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And InStr(FullAlarmSourceName, " & Chr(34) & UCase(tag.Value) & Chr(34) &")" & "> 0 And Severity = " & severity & _
" And Instr(EventCategory, " & Chr(34) & tab & Chr(34) &")> 0" & " And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & _
"> 0 And Instr(Operator, " & Chr(34) & UCase(ope.Value) & "> 0"
'Filtra intervalo de datas e severidade
ElseIf tag.Value = "" And sev.SelText <> "" And tabela.SelText = "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Severity = " & severity
'Filtra intervalo de datas, severidade e tabela
ElseIf tag.Value = "" And sev.SelText <> "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Severity = " & severity & " And Instr(EventCategory," & Chr(34) & tab & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, severidade, tabela e mensagem
ElseIf tag.Value = "" And sev.SelText <> "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Severity = " & severity & " And Instr(EventCategory," & Chr(34) & tab & Chr(34) &")" & "> 0" & _
" And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, severidade, tabela, mensagem e operador
ElseIf tag.Value = "" And sev.SelText <> "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Severity = " & severity & " And Instr(EventCategory," & Chr(34) & tab & Chr(34) &")" & "> 0" & _
" And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0 And Instr(Operator, " & Chr(34) & UCase(ope.Value) & "> 0"
'Filtra intervalo de datas, tabela
ElseIf tag.Value = "" And sev.SelText = "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Instr(EventCategory," & Chr(34) & tab & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, tabela, mensagem
ElseIf tag.Value = "" And sev.SelText = "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Instr(EventCategory," & Chr(34) & tab & Chr(34) &")" & "> 0 And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, tabela mensagem e operador
ElseIf tag.Value = "" And sev.SelText = "" And tabela.SelText <> "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Instr(EventCategory," & Chr(34) & tab & Chr(34) &")" & "> 0 And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0 " & _
" And Instr(Operator, " & Chr(34) & UCase(ope.Value) & "> 0"
'Filtra intervalo de datas, mensagem
ElseIf tag.Value = "" And sev.SelText = "" And tabela.SelText = "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0"
'Filtra intervalo de datas, mensagem e operador
ElseIf tag.Value = "" And sev.SelText = "" And tabela.SelText = "" And msg.Value <> "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Instr(Message," & Chr(34) & UCase(msg.Value) & Chr(34) &")" & "> 0 And Instr(Operator, " & Chr(34) & UCase(ope.Value) & "> 0"
'Filtra intervalo de datas e operador
ElseIf tag.Value = "" And sev.SelText = "" And tabela.SelText = "" And msg.Value = "" And ope.Value <> "" Then
txtFiltro = txtFiltro & " And Instr(Operator, " & Chr(34) & UCase(ope.Value) & "> 0"
End If
End If