cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Query Formatting with two different types

bmellish
5-Regular Member

Query Formatting with two different types

I would like to run a two part query that as a type of "And" and "Or".  Something like this:

var query2 = {
    "filters": {
        "type": "Or",
        "filters": [
            {
                "type": "Matches",
                "fieldName": "Name",
                "expression": "Asset_1"
            },
            {
                "type": "Matches",
                "fieldName": "Name",
                "expression": "Asset_2"
            }
        ],
        "type": "AND",
        "filters":[
            {
                "fieldName":"modelNumber",
             	"value":"theModelNumber",
             	"type":"EQ"
            }
        ]        
    }
    };

Although this seems like it should match, it does not return anything.  I can not find an example of this kind of query, I'm guessing my syntax is wrong somehow.  Has anyone every done this before?

1 REPLY 1
bmellish
5-Regular Member
(To:bmellish)

It should look like this for anyone who may have the same question.

var query2 = {
    "filters": {
        "type": "AND",
        "filters": [
            {
            "type": "OR",
            "filters": [{"type": "Matches","fieldName": "Name","expression": "Asset_1"},
                        {"type": "Matches","fieldName": "Name","expression": "Asset_2"}]
            },        
            {
                "fieldName":"modelNumber","isCaseSensitive":true,"value":"theModelNumber","type":"EQ"
            }
        ]        
    }
    };
Top Tags