-------------------------------------------- Separ...
# gooddata-platform
-------------------------------------------- Separate question: In MAQL, how can I filter the value of a BOOL field? When I try
SELECT SUM({{fact}}) WHERE {{attribute}}
I get "Can't display this insight" on all affected insights. When I try
SELECT SUM({{fact}}) WHERE {{attribute}} = TRUE
= true
) The metric edit window does not want to save When I try
SELECT SUM({{fact}}) WHERE {{attribute}} LIKE 'true'
I get an error that LIKE is only applicable to labels -- How should I handle this?
When filtering with the Where clause, you will need to assign an attribute value after the attribute you’ve called for “WHERE.” These objects also must be connected in the LDM. If you are still facing issues, could you please DM and I can try and take a look directly at what you are trying to achieve?
Hey Joseph, I tried the solutions presented in the link provided already, to no avail. Since this attribute is used to filter all applicable metrics so far in our insights, I decided to filter directly the dataset and remove the filter in the insights. If I need an unfiltered version I'll create a separate dataset with the filter attribute available. Cheers!
Technically there is no BOOL field in GoodData. In your Logical Data Model the data type of that attribute/label is most probably TEXT so you would work with it as with any other text attribute - that means the correct way of doing it is:
SELECT SUM({{fact}}) WHERE {{attribute}} = <value selected from the list of loaded attribute values>
so you need to select the value from the “attribtue values” list (assuming we are speaking about the hosted GoodData). Alternatively what would also work but would be much slower to use LIKE with a label, but the attribute + specific value has much better performance.
👍 2
I believe I also I tried
= 'true'
and it did not work - but I may be recollecting wrong
Hi, you should select the value true from the list of values under “Attribute Values”
For the LIKE operator you have to use double quotes. E.g.
Copy code
select SUM(fact) WHERE attribute ILIKE "true"
btw. ILIKE will ignore the case. I would however recommend to use = or IN operator rather than LIKE operator for performance reasons.