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:

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

Leave a Reply

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

*