2 Replies Latest reply on Nov 21, 2015 11:25 AM by chadha RSS
    mateuszboc Explorer

    Combine two queries or force value in data filter widget.

    Hi,

    I would like to combine two queries.


    Use case: I've got boolean field in my stream, and I want to display on some charts only data where this boolean is true. So my default query for some service is like: {"filters":{"expression":"true","type":"Matches","fieldName":"Valid"}}. But when user define his own query using DataFilter widget, than he is able to see all valid and invalid data as long as he manually don't check valid = true in DataFilter widget. 


    I was trying to write my own service for joining two queries but Query object behaves strangely - it lacks functions like 'push' for Array objects 


    ex.

    query = {   "filters": {     "type": "AND",     "filters": [       {         "fieldName": "Complex1",         "type": "NE",         "value": 30       },       {         "fieldName": "Complex2",         "type": "EQ",         "value": 1       }     ]   } };


    when I code: 

    query.filters.filters.push( whatever ) I get an Error:  Cannot find function push in object . (joinQuery#72).


    Is there any place where I can find documentation of prototype functions available for different TW build-in objects?

    Is there any snippet for joining Queries?

    Is there any way to force DataFilter widget to set value always to true/false?