How to create a view that has two “AND” in criteria instead of “AND” and “OR”

January 28, 2011 Posted by Stefan Allansson

There is a default view called “All open incidents”, that shows all incidents except resolved and closed.
Maybe you want to create a new view that shows all incidents except resolved and closed and has a specific Support Group(in my case the Support Group is called IT-Support)

If you do that in the console, the criteria look like this:

 

Everything seems good so far, but when you open that view you will see all incidents, including resolved and closed incidents. So how do you solve this?
We have to do some changes in the XML file.
Right click your view and choose edit to see which management pack you have saved it into:

 

Export your management pack and open your XML file.

If you have more views in the same management pack, you can search in the file for a display name that matches your view.

<DisplayString ElementID=”View.a1ac40bb826b49d88485931b22022ece”>
          <Name>IT-Support Open Incidents</Name>

Do a new search in the XML file for the name that represents the “DisplayString ElementID”. In my case View.a1ac40bb826b49d88485931b22022ece, and you will find this:

<View ID=”View.a1ac40bb826b49d88485931b22022ece”

Scroll down a little bit more and you find <Criteria>where you have three values for the criteria you specified in your view.
The first criteria, in my case “Support Group” is under <Operator>Equal</Operator> and  the second, which is the status “Resolved” is under <Operator>NotEqual</Operator>.
Between those values there is <Expression>  and <Or>. Delete those two. After the last criteria you have </Or> and </Expression> which you also have to delete.

 

Save your XML file and import it again.
Restart your console before you open your view.
Now you will see all incidents except resolved and closed incidents.
If you look at your view in edit mode in the console it now looks like this:

 

And before we edited the XML it looked like this:

5 Responses to How to create a view that has two “AND” in criteria instead of “AND” and “OR”

  1. Valnir Fiel says:

    Thank you for this very helpfull article, I looking for this solutions because of the very complex criteria I have got to define.

    • Valnir Fiel says:

      Thank you for this very helpful article, I was looking for this solutions because of the very complex criteria I have got to define.

  2. RDurbin says:

    Would you happen to know if its possible to change the operators from equal to something equivilent to contains?

    For instance if i have a list of locations to select on my incident form that resembles this:

    Region 1
    >0001 – Branch 1
    >0002 – Branch 2
    Region 3
    >0003 – Branch 3
    >0004 – Branch 4

    when the Branch 3 is selected in the list, the values loaded into the list picker would be “Region 3003 – Branch 3″

    If i wanted to create a view that displayed all tickets from any branches in region 3 I would need to do an operator such as contains to find only the Region 3 piece of the string.

    Any suggestions?

    Thanks,

    Ryan

    • Anders Asp says:

      Hi,

      Contain criteria can’t be used together with lists. Why? Because the text you see in the console is a display string and not the actual value for the list. The actual value is something like Enum.

  3. Great post just what i needed

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>