Skip to content
Developerhome
Sage Distribution and Manufacturing Operations

Filters and counts on queries

  Less than to read

Just after the query, you can add parameters to filter the data. You can also add in the query body a totalCount variable that counts the number of records found when the filter is applied.

Filters are expressed in a string with various syntaxes.

The following table displays an example and the result of applying a filter. Some of the fields displayed are not mandatory and others have been omitted.

{ 
    xtremMasterData { 
        item { 
            query (filter: "{isActive:true}"){ 
                totalCount 
                edges { 
                    node { 
                        isActive 
                        name 
                        stockUnit { 
                            name 
                            symbol 
                        } 
                    } 
                } 
            } 
        } 
    }
} 
{ 
"data": { 
    "xtremMasterData": { 
        "item": { 
            "query": { 
                "totalCount": 53, 
                "edges": [ 
                    { 
                        "node": { 
                            "isActive": true, 
                            "name": "Capteur pression", 
                            "stockUnit": { 
                                "name": "each", 
                                "symbol": "each" 
                                } 
                            } 
                        }, 
                        { 
                            "node": { 
                                "isActive": true, 
                                "name":"Capteur haute pression", 
                                "stockUnit": { 
                                    "name": "each", 
                                    "symbol": "each" 
                                } 
                            } 
                        }
                    ]
                }
            }
        }
    }
}