Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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?
Did you ever find an answer to this question?
Consider a custom service which accepts a user's query, and also applies the "Valid=true" query to build the result.
var valid = {"filters":{"expression":"true","type":"Matches","fieldName":"Valid"}};
var result = me.QueryStreamEntriesWithData({ query : valid });
if(userQuery) result = Resources.InfoTableFunctions.Query({ t : result, query : userQuery });
Then, bind the mashup to use this service instead of the built-in QueryStreamEntriesWithData (or similar).