I have a data set of multiple types of data (string, number, date, boolean). An example array of objects could be
[{
string: 'sample',
number: 1,
isValid: true,
date: new Date()
},
{
string: 'sample2',
number: 2,
isValid: false,
date: new Date()
},
string: 'sample3',
number: 3,
isValid: false,
date: random date
}, ... and so forth]
What my columns on my QueryBuilderComponent is
[{field: 'string', label: 'String', type: 'string'},
{field: 'number', label: 'Number', type: 'number'},
{field: 'isValid', label: 'Is Valid', type: 'boolean'},
{field: 'date', label: 'Date', type: 'date'}]
1. It was difficult finding the specific docs for the column options but I attempted to use type boolean for one of the qb columns and when building a query, the predicate value returned from qbObj.getPredicate are strings True and False. This fails the equal query because it is trying to compare string 'True' with boolean true. How can I get query builder to compare boolean values properly?
2. When attempting the above, I also tried changing the QueryBuilderComponent column into {field: 'isValid', label: 'Is Valid', type: 'boolean', values: [true, false]}. This would actually query the data properly but then the text for false would not show up. If this is the right way to go about querying for bool, how would I properly get the text for false?
3. T.his may be a bug or just myself but when adding a new collection or first attempting to make a query, I open the query builder via button click. I load the query builder into a modal
Select a field
Select operator
but I DO NOT select a value true, false, or any other value for the other operators and click Apply, it triggers getPredicate but returns undefined, although clearly there is something 'selected' (false appears selected by default). How do I actually apply a default value when a collection is added?
4. Is there a way to show the full query string applied to the data source? For instance, if I use the query builder to filter isValid equals true AND number isgreaterthan 1, output that query string into a div or component something along the lines of "isValid = true AND number > 1".
5. How would I clear the query and reset the data source grid on click of a 'clear' button?